« Return to Thread: Memory leaks - what causes them?

Re: Memory leaks - what causes them?

by Gregg Liming :: Rate this Message:

Reply to Author | View in Thread

David Norwood wrote:

> Gregg wrote:
>
>> David Norwood wrote:
>>
>>> To tell you the truth, I've seen this question asked many times but
>>> never seen an example of code that causes a memory leak in misterhouse.
>> It's always been unbounded arrays that I've seen be the culprit.
>> Specifically, shoving the same value or object into an array w/o
>> checking on its existence first (if appropriate).  An example here of
>> proper bounding is Base_Item::add_item_if_not_present.  If memory leaks
>> happen on reload, then it's usually non-object arrays that I've seen in
>> both common code and libs.
>
> I've narrowed my memory leak problem down to the rss_file_process subroutine
> in my mh/code/common/rss_subscriber.pl script.  Each of the arrays and
> hashes are defined locally to the subroutine in "my  ..." statements.
> Doesn't that mean the memory they take up is freed when the subroutine
> returns?

I can't think of a reason why they wouldn't be.

> Would you mind taking a look at the rss_file_process subroutine in
> mh/code/common/rss_subscriber.pl and see if you find a problem?

Nothing immediately "jumps out".  But a couple of questions:

1) Do you ever see "Process Eval results: ... " displayed?  If so, then
I wonder if there is a problem if the untie is never reached (line 210
in rss_subscribed.pl).

2) Have you tried uncommenting exit and commenting out exec 'true' in
Process_Item (lines 193 and 196)?  You'd have to assess whether doing so
might cause issues elsewhere.  Given the comments there about DESTROY, I
wonder if there's missing garbage collection.

3) Is there any purpose to $list and @itemslist in rss_file_process?
(this is more a "housekeeping" question than anything else).

I'll stare at it some more; but, am quite curious about #1 and #2.

Gregg

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

 « Return to Thread: Memory leaks - what causes them?