HN user

osn

6 karma
Posts0
Comments7
View on HN
No posts found.

GC doesn't preven all the memory leaks. En easy example is a stack class backeed by an array. If you need more members, you allocate a bigger array and copy members. (The GC takes care of the smaller old array).

So far so good. But You forget to allocate smaller array (and copy members) when you consume too much memory. So 1000000* push(something) followed by 1000000*pop() keeps plenty allocated memory not in usage.

(It's not as brutal as malloc() and forget the result but still pretty awfull situation in a large project.)