Simple way to get an effective memory leak

  • Thread starter Thread starter creator_bob
  • Start date Start date
C

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.
 
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
 
Jeff said:
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.
 
Ah, got it.

creator_bob said:
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.
 
Back
Top