Home All Groups Group Topic Archive Search About

Simple way to get an effective memory leak

Author
13 Apr 2006 1:19 PM
creator_bob
I decided to post here after a little incident where I got an effective
memory leak that was immune from garbage collection.

I created a simple binary tree, no balancing or deleting.  Only two
functions from the root--update (add if missing), and read.  The
problem was the update had a bug and after updating, it would always
then add as though the item were missing.  This caused the tree to grow
unbounded, but from all outward appearances, the program ran normal.

Just pointing out that it is very easy to get an effective memory leak
even with garbage collection.

Author
13 Apr 2006 10:03 PM
Jeff Dillon
I don't see this as a leak at all, but rather an error in logic? How would
garbage collection catch this? It is assuming you needed those locations, I
would assume.

Jeff

Show quoteHide quote
"creator_bob" <robertbrich***@hotmail.com> wrote in message
news:1144934399.699874.23660@i39g2000cwa.googlegroups.com...
>I decided to post here after a little incident where I got an effective
> memory leak that was immune from garbage collection.
>
> I created a simple binary tree, no balancing or deleting.  Only two
> functions from the root--update (add if missing), and read.  The
> problem was the update had a bug and after updating, it would always
> then add as though the item were missing.  This caused the tree to grow
> unbounded, but from all outward appearances, the program ran normal.
>
> Just pointing out that it is very easy to get an effective memory leak
> even with garbage collection.
>
Author
13 Apr 2006 10:42 PM
creator_bob
Jeff Dillon wrote:
> I don't see this as a leak at all, but rather an error in logic? How would
> garbage collection catch this? It is assuming you needed those locations, I
> would assume.
>
> Jeff
>
My point is that even though memory leaks are all but impossible,
faulty logic can still have the same effect as a leak and still not be
detected.  I'm new here; this has probably been discussed many times.
Note the word "effective".  I didn't say it was a leak.  My point is
that programmers must still be vigilant and not think that things like
this can't happen to them; there are ways to use up memory even with a
garbage collector.
Author
13 Apr 2006 10:47 PM
Jeff Dillon
Ah, got it.

Show quoteHide quote
"creator_bob" <robertbrich***@hotmail.com> wrote in message
news:1144968158.018421.305640@j33g2000cwa.googlegroups.com...
>
> Jeff Dillon wrote:
>> I don't see this as a leak at all, but rather an error in logic? How
>> would
>> garbage collection catch this? It is assuming you needed those locations,
>> I
>> would assume.
>>
>> Jeff
>>
> My point is that even though memory leaks are all but impossible,
> faulty logic can still have the same effect as a leak and still not be
> detected.  I'm new here; this has probably been discussed many times.
> Note the word "effective".  I didn't say it was a leak.  My point is
> that programmers must still be vigilant and not think that things like
> this can't happen to them; there are ways to use up memory even with a
> garbage collector.
>