CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.

Insure HOWTO

Author: Emmanuel Medernach

Date: 10 Sept 2001

Guide to using Insure


1. Introduction

Insure++ is a toolkit to detect memory leak in C / C++ programs. It is used at run-time and provide a report of memory usage.

2. Configuration file

The configuration file of Insure++ is .psrc in your home directory. You could use another file with:
  insure -Zop .psrc
Here is a base configuration file for Insure:
#
#  Insure configuration
#

Insure++.ReportFile stderr
insure++.temp_directory /tmp
insure++.compiler_cpp g++
#
insure++.coverage_map_data off
insure++.malloc_replace off
insure++.stdlib_replace off
insure++.error_format "\"%f\", line %l: %c"
insure++.checking_level full
insure++.checking_uninit on

      

Note that Codewizard uses the same configuration file. It is better to comment the Codewizard lines to prevent a conflict.

3. Running Insure

First you have to have /afs/cern.ch/pttools/Insure linked to /pttools/Insure and /afs/cern.ch/pttools/FlexLm to /pttools/FlexLm

The environment is setup by a script.

 source /pttools/Insure/insure/linux/insure.sh
In order to use Insure you have to compile your files with insure. You could have line information in the report by compiling with debug option.

This can be done by setting an environment variable, like with QPlotter:
 gmake all "USE_INSURE=1" "DEBUG=1"
When you run your program, insure will put in stderr the report. You could change that behaviour to produce an output file with this line in the ~/.psrc
  insure++.report_file %v.insure

4. Trouble shooting

Warning : If the same name is given to a local variable, a parameter or a member variable Insure could get confused and give a strange behaviour. Try to use a prefix as many as possible.

5. Links

Leave the site [Insure at CERN]

Leave the site [Insure Reference Guide]