|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
memory debugging
Hi,
I have developed a rather large program in python that leaks memory somewhere. However I have no idea where. Does anyone know of tools that can help with finding memory leaks in python? Alternatively is there some way to query the amount of memory a program uses from within python? Thanks in advance, Frederik Fix |
|
#2
|
||||
|
||||
|
I've never had much a problem with memory leaks in Python and have only got a MemoryError once in the time i've used it so Python seems to be pretty good at limiting this. In any case manybe these likes will help:
http://www.nightmare.com/medusa/memory-leaks.html http://zope.org/Members/mcdonc/HowT...ndDebugMemLeaks - Python and Zope You might also like to check out pythons profiler modules although i'm not sure if they show memory usage or not... http://www.python.org/doc/2.3.3/lib/module-profile.html http://www.python.org/doc/2.3.3/lib/module-hotshot.html But if you fire up your browser and search google a little i'm sure you'll be able to find what your looking for .Hope this is of some help, Mark. Last edited by netytan : March 26th, 2004 at 09:59 AM. |
|
#3
|
|||
|
|||
|
If you are using a modern version of Python that has been compiled with garbage collection enabled, then you can use the 'gc' module in the standard library to get information about the objects known to the garbage collector, force garbage collection, trace object creation and deletion, etc. RTFM for full information.
For earlier versions of Python there is a tool called Cyclops written by Python Guru Tim Peters. This tracks down and reports cyclic object references. It is rather dated (1999) but should still work with current versions of Python. You can find it on the Python.org FTP server - http://www.python.org/ftp/python/co...ec-1999/System/. There may be more recent versions around, but I have not found any. If garbage collection is enabled then cycles should not be such a problem unless an object cannot be freed by the GC. There is also a function in the sys module 'getrefcount' that you can use to find out how many reference there are to an object. Between these three, you should be able to track down any leaks in your Python code. Leaks in extension modules is another matter. Hope this helps, Dave - The Developers' Coach Last edited by DevCoach : March 26th, 2004 at 10:42 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > memory debugging |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|