Classes on stack

Paul Backus snarwin at gmail.com
Thu Sep 1 17:50:56 UTC 2022


On Thursday, 1 September 2022 at 17:24:41 UTC, Ali Çehreli wrote:
> The only time I had a memory leak in D was due to integral 
> values being mistaken for pointers for a 32-bit build when I 
> was loading files into huge buffers. I don't use 32 bits 
> anymore, I don't do that anymore, and D runtime has been 
> improved since then to have some information where actual 
> pointers are.

Recently, we had someone in the community Discord ask for help 
tracking down a memory leak in their D project, which used the GC.

After a bit of investigation, it turned out that the leak was 
coming from a C library holding onto manually-allocated data 
longer than expected. In order to free it, the user had to call 
an additional library function to indicate that the data was no 
longer needed.

Moral of the story: if you are worried about memory leaks, the GC 
is your friend, not your enemy. :)


More information about the Digitalmars-d mailing list