source: python/vendor/Python-2.6.5/Misc/PURIFY.README

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 4.4 KB
Line 
1Purify (tm) and Quantify (tm) are commercial software quality
2assurance tools available from IBM <http://www.ibm.com/software/rational/>.
3Purify is essentially a memory access
4verifier and leak detector; Quantify is a C level profiler. The rest
5of this file assumes you generally know how to use Purify and
6Quantify, and that you have installed valid licenses for these
7products. If you haven't installed such licenses, you can ignore the
8following since it won't help you a bit!
9
10You can easily build a Purify or Quantify instrumented version of the
11Python interpreter by passing the PURIFY variable to the make command
12at the top of the Python tree:
13
14 make PURIFY=purify
15
16This assumes that the `purify' program is on your $PATH. Note that
17you cannot both Purify and Quantify the Python interpreter (or any
18program for that matter) at the same time. If you want to build a
19Quantify'd interpreter, do this:
20
21 make PURIFY=quantify
22
23Starting with Python 2.3, pymalloc is enabled by default. This
24will cause many supurious warnings. Modify Objects/obmalloc.c
25and enable Py_USING_MEMORY_DEBUGGER by uncommenting it.
26README.valgrind has more details about why this is necessary.
27See below about setting up suppressions. Some tests may not
28run well with Purify due to heavy memory or CPU usage. These
29tests may include: test_largefile, test_import, and test_long.
30
31Please report any findings (problems or no warnings) to python-dev@python.org.
32It may be useful to submit a bug report for any problems.
33
34When running the regression test (make test), I have found it useful
35to set my PURIFYOPTIONS environment variable using the following
36(bash) shell function. Check out the Purify documentation for
37details:
38
39p() {
40 chainlen='-chain-length=12'
41 ignoresigs='-ignore-signals="SIGHUP,SIGINT,SIGQUIT,SIGILL,SIGTRAP,SIGAVRT,SIGEMT,SIGFPE,SIGKILL,SIGBUS,SIGSEGV,SIGPIPE,SIGTERM,SIGUSR1,SIGUSR2,SIGPOLL,SIGXCPU,SIGXFSZ,SIGFREEZE,SIGTHAW,SIGRTMIN,SIGRTMAX"'
42 followchild='-follow-child-processes=yes'
43 threads='-max-threads=50'
44 export PURIFYOPTIONS="$chainlen $ignoresigs $followchild $threads"
45 echo $PURIFYOPTIONS
46}
47
48Note that you may want to crank -chain-length up even further. A
49value of 20 should get you the entire stack up into the Python C code
50in all situations.
51
52With the regression test on a fatly configured interpreter
53(i.e. including as many modules as possible in your Modules/Setup
54file), you'll probably get a gabillion UMR errors, and a few MLK
55errors. I think most of these can be safely suppressed by putting the
56following in your .purify file:
57
58 suppress umr ...; "socketmodule.c"
59 suppress umr ...; time_strftime
60 suppress umr ...; "dbmmodule.c"
61 suppress umr ...; "gdbmmodule.c"
62 suppress umr ...; "grpmodule.c"
63 suppress umr ...; "nismodule.c"
64 suppress umr ...; "pwdmodule.c"
65
66Note: this list is very old and may not be accurate any longer.
67It's possible some of these no longer need to be suppressed.
68You will also need to suppress warnings (at least umr)
69from Py_ADDRESS_IN_RANGE.
70
71This will still leave you with just a few UMR, mostly in the readline
72library, which you can safely ignore. A lot of work has gone into
73Python 1.5 to plug as many leaks as possible.
74
75Using Purify or Quantify in this way will give you coarse grained
76reports on the whole Python interpreter. You can actually get more
77fine grained control over both by linking with the optional `pure'
78module, which exports (most of) the Purify and Quantify C API's into
79Python. To link in this module (it must be statically linked), edit
80your Modules/Setup file for your site, and rebuild the interpreter.
81You might want to check out the comments in the Modules/puremodule.c
82file for some idiosyncrasies.
83
84Using this module, you can actually profile or leak test a small
85section of code, instead of the whole interpreter. Using this in
86conjuction with pdb.py, dbx, or the profiler.py module really gives
87you quite a bit of introspective power.
88
89Naturally there are a couple of caveats. This has only been tested
90with Purify 4.0.1 and Quantify 2.1-beta on Solaris 2.5. Purify 4.0.1
91does not work with Solaris 2.6, but Purify 4.1 which reportedly will,
92is currently in beta test. There are funky problems when Purify'ing a
93Python interpreter build with threads. I've had a lot of problems
94getting this to work, so I generally don't build with threads when I'm
95Purify'ing. If you get this to work, let us know!
96
97-Barry Warsaw <bwarsaw@cnri.reston.va.us>
Note: See TracBrowser for help on using the repository browser.