[Patches] [Patch #101229] Optional memory profiler

noreply@sourceforge.net noreply@sourceforge.net
Thu, 04 Jan 2001 09:17:21 -0800


Patch #101229 has been updated. 

Project: python
Category: core (C code)
Status: Open
Submitted by: marangoz
Assigned to : jhylton
Summary: Optional memory profiler

Follow-Ups:

Date: 2000-Aug-19 00:18
By: marangoz

Comment:
An optional memory profiler, which goes in tandem with the optional
object memory allocator (SourceForge patch #101104). The profiler was
introduced briefly on python-dev:
http://www.python.org/pipermail/python-dev/2000-August/015239.html

Applying both patches gives for me (screen dump):

~> patch -p1 < ../obmalloc-patch
patching file `Include/objimpl.h'
patching file `Objects/object.c'
patching file `Objects/obmalloc.c'
patching file `acconfig.h'
patching file `configure.in'
~> patch -p1 < ../memprof-patch
patching file `Include/pydebug.h'
patching file `Modules/Setup.config.in'
patching file `Modules/main.c'
patching file `Modules/memprof.c'
patching file `Python/pythonrun.c'
patching file `acconfig.h'
patching file `configure.in'

- Don't forget that you need to autoheader; autoconf;

This patch:

1) introduces a new --with-memprof configure option. Off by default.
2) introduced a Py_ProfileFlag and a "-p" Python option which starts
    the profiler in Py_Initialize() before any initializations, and stops
it
    in Py_Finalize() after all finalizations.
3) contains a new Modules/memprof.c module. The inclusion of this file
   in the core is similar to the thread and GC modules (Setup.config.in)

The patch *can* be applied without the object allocator and it *does*
compile on request. However, it issues a warning that it won't profile
anything, because it can't be called (the profiler can't install its
hooks).
Besides, it will refuse to start(). The point is that both the profiler
and
the allocator are really optional.

Needs docs & tests :( The interface can be improved (just like everything
else) but the core functionality is there. It *is* useful for getting
snapshots
of the minimum allocated (object) memory, at least. Some worthy points to
condifer, IMO, are listed in the TODO of memprof.c.

I am submitting this for testing, reviewing, comments and more ideas.
Overall, I think it is a BIG plus regarding Python's typical
introspection.

Comments welcome. As usual, flames to /dev/null <wink>.

Status set straight to Postponed. Assigned to marangoz who's in charge of
opening it in due time, together with #101104.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101229&group_id=5470