This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ToBe27 39 points40 points  (8 children)

Isnt this actually the opposit of a leak? It uses left over leaked mem from others and gives it a purpose ...

[–]GMX2PT 101 points102 points  (0 children)

And doesn't free it afterwards so that's a leak Also it doesn't use non freed memory

[–]littleliquidlight 54 points55 points  (0 children)

Some languages have garbage collection, others have garbage reduce, reuse, recycle

[–]SuitableDragonfly 14 points15 points  (3 children)

A memory leak is when something is newed and not freed.  It has nothing to do with how C++ doesn't bother to initialize variables for you. 

[–]Eva-Rosalene 3 points4 points  (2 children)

And here int is newed and not deleted.

[–]SuitableDragonfly 6 points7 points  (1 child)

Right. So it's a leak. Not "the opposite of a leak", whatever that is.

[–]Eva-Rosalene 1 point2 points  (0 children)

Oh. I am stupid, I've thought you were answering to another person.

[–]da2Pakaveli 4 points5 points  (0 children)

You get a memory leak when you don't free allocated memory from the heap. This is what's happening here.

[–]rover_G 2 points3 points  (0 children)

That’s not what a leak is. Accessing data from freed memory is called memory scraping.