472,950 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 software developers and data experts.

Understanding memory leak reports

Hi,
I'm in a big trouble since I don't know how to find some memory leaks
I just discovered in a program of mine.
By putting:

import gc
gc.set_debug(gc.DEBUG_LEAK)

...at the end of a script which imports a module I wrote it seems I
have some memory leaks scattered around.
The message printed on screen is the following:

gc: collectable <function 00C70E70>
gc: collectable <type 00B41018>
gc: collectable <dict 00C6DE40>
gc: collectable <tuple 00C09900>
gc: collectable <tuple 00BCD510>
gc: collectable <function 00C70EB0>
gc: collectable <function 00C70E30>

Since the main module is very big (more than 2800 lines of code) I do
not understand which objects are not garbage collected.
Is there a way to have a more detailed message to know which objects
are not garbage collected?
For example "function foo", "method MyClass.bar", "dict my_dict"...
"function 00C70E70" and "tuple 00C09900" are too much generic messages
which don't give me an idea about where the leak could be.
Dec 21 '07 #1
5 4012
On Dec 21, 12:44 pm, "Giampaolo Rodola'" <gne...@gmail.comwrote:
Hi,
I'm in a big trouble since I don't know how to find some memory leaks
I just discovered in a program of mine.
By putting:

import gc
gc.set_debug(gc.DEBUG_LEAK)

..at the end of a script which imports a module I wrote it seems I
have some memory leaks scattered around.
The message printed on screen is the following:

gc: collectable <function 00C70E70>
gc: collectable <type 00B41018>
gc: collectable <dict 00C6DE40>
gc: collectable <tuple 00C09900>
gc: collectable <tuple 00BCD510>
gc: collectable <function 00C70EB0>
gc: collectable <function 00C70E30>

Since the main module is very big (more than 2800 lines of code) I do
not understand which objects are not garbage collected.
Is there a way to have a more detailed message to know which objects
are not garbage collected?
For example "function foo", "method MyClass.bar", "dict my_dict"...
"function 00C70E70" and "tuple 00C09900" are too much generic messages
which don't give me an idea about where the leak could be.
I've never done this before, but here's what I found while Googling:

Recipe that supposedly gives more info:
http://aspn.activestate.com/ASPN/Coo...n/Recipe/65333

Another thread on the same topic that looks quite detailed:
http://www.thescripts.com/forum/thread22097.html

An article or two on memory leaks in Python:
http://utcc.utoronto.ca/~cks/space/b...honMemoryLeaks
http://www.nightmare.com/medusa/memory-leaks.html

I hope they help.

Mike
Dec 21 '07 #2
On 21 Dic, 20:10, kyoso...@gmail.com wrote:
On Dec 21, 12:44 pm, "Giampaolo Rodola'" <gne...@gmail.comwrote:


Hi,
I'm in a big trouble since I don't know how to find some memory leaks
I just discovered in a program of mine.
By putting:
import gc
gc.set_debug(gc.DEBUG_LEAK)
..at the end of a script which imports a module I wrote it seems I
have some memory leaks scattered around.
The message printed on screen is the following:
gc: collectable <function 00C70E70>
gc: collectable <type 00B41018>
gc: collectable <dict 00C6DE40>
gc: collectable <tuple 00C09900>
gc: collectable <tuple 00BCD510>
gc: collectable <function 00C70EB0>
gc: collectable <function 00C70E30>
Since the main module is very big (more than 2800 lines of code) I do
not understand which objects are not garbage collected.
Is there a way to have a more detailed message to know which objects
are not garbage collected?
For example "function foo", "method MyClass.bar", "dict my_dict"...
"function 00C70E70" and "tuple 00C09900" are too much generic messages
which don't give me an idea about where the leak could be.

I've never done this before, but here's what I found while Googling:

Recipe that supposedly gives more info:http://aspn.activestate.com/ASPN/Coo...n/Recipe/65333

Another thread on the same topic that looks quite detailed:http://www.thescripts.com/forum/thread22097.html

An article or two on memory leaks in Python:http://utcc.utoronto.ca/~cks/space/b...ory-leaks.html

I hope they help.

Mike- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -
Thanks for your search but I haven't actually found a solution yet.
I've tried to search into the cookbook. I found other recipes playing
with the gc module but it seems that none of them are useful for
finding out the names of the objects causing the memory leak.
I've tried to play with gc.get_objects() in the hope to find the real
names manually but it returns a very large number of objects.
If only I could find a way to make gc.get_objects() returning leaking
objects only it would be a step forward...
Does someone have an idea about how doing such a thing?
Dec 21 '07 #3
Giampaolo Rodola' <gn****@gmail.comwrote:
>I'm in a big trouble since I don't know how to find some memory leaks
....
>The message printed on screen is the following:

gc: collectable <function 00C70E70>
gc: collectable <type 00B41018>
gc: collectable <dict 00C6DE40>
gc: collectable <tuple 00C09900>
gc: collectable <tuple 00BCD510>
gc: collectable <function 00C70EB0>
gc: collectable <function 00C70E30>

Since the main module is very big (more than 2800 lines of code) I do
not understand which objects are not garbage collected.
They are being garbage collected. That's what the "collectable" part
of the message means. It's just a warning that those objects needed
to be garbage collected because they were refering to each other in
some sort of cycle. While the memory used was being wasted before the
garbage collector ran, it probably doesn't have any negative effect on
your program.

Ross Ridge

--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rr****@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Dec 22 '07 #4
On 22 Dic, 01:27, Ross Ridge <rri...@caffeine.csclub.uwaterloo.ca>
wrote:
Giampaolo Rodola' <gne...@gmail.comwrote:
I'm in a big trouble since I don't know how to find some memory leaks
...
The message printed on screen is the following:
gc: collectable <function 00C70E70>
gc: collectable <type 00B41018>
gc: collectable <dict 00C6DE40>
gc: collectable <tuple 00C09900>
gc: collectable <tuple 00BCD510>
gc: collectable <function 00C70EB0>
gc: collectable <function 00C70E30>
Since the main module is very big (more than 2800 lines of code) I do
not understand which objects are not garbage collected.

They are being garbage collected. *That's what the "collectable" part
of the message means. *It's just a warning that those objects needed
to be garbage collected because they were refering to each other in
some sort of cycle. *While the memory used was being wasted before the
garbage collector ran, it probably doesn't have any negative effect on
your program.

* * * * * * * * * * * * * * * * * * * * * * * * Ross Ridge
Uhm... that's a good news altough it doesn't seem to me that I used
any sort of cicle.
Thank you.
Dec 22 '07 #5
On Dec 21, 1:44 pm, "Giampaolo Rodola'" <gne...@gmail.comwrote:
Since the main module is very big (more than 2800 lines of code)
maybe that is the actual problem to begin with,

you should refactor it so it it more modular and trackable, otherwise
this is just one of the many issues that will crop up,

just an opinion.

i.

Dec 22 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that,...
5
by: blugus | last post by:
Hi Guys, I've been try to use Dinkum STL library. It workes well first, but report memory leak in MFC Debug Mode. I use Dinkum Unabridged Library for VC++ V4.02, MSVC6, WIN2000 SERVER. I...
7
by: Xing | last post by:
Hi all I am not an ASP developer but I am in a support case for our customer who's experiencing resource problems that seems to be ASP.NET related. Basically our app is built on .NET Framework 1.1...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
17
by: Mike | last post by:
Hello, I have following existing code. And there is memory leak. Anyone know how to get ride of it? function foo has been used in thousands places, the signature is not allowed to change. ...
1
by: Archana | last post by:
Hi all, I am new to c++. I have written one c++ application. I want to detect memory leaks from my program. I tried with following code which i got from net. if(_CrtDumpMemoryLeaks() ==...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
3
by: not_a_commie | last post by:
The CLR won't garbage collect until it needs to. You should see the memory usage climb for some time before stabilizing. Can you change your declaration to use the 'out' keyword rather than a 'ref'...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.