Memory Leak with C functions?

bearophile bearophileHUGS at lycos.com
Thu Nov 28 02:32:07 PST 2013


Namespace:

> If I compile this code with dmd test.d and execute it, I see a 
> memory usage of ~ 1332K. If I press enter the programm allocate 
> 100_000 int's and the memory usage increased to  ~ 1720 K. If I 
> now press enter I assumed that the memory usage decreased to ~ 
> 1332 K again, but it is still ~ 1720 K. Why?

This is system-dependent. Sometimes the memory allocated by a 
program is released to the OS only when the a program ends. But 
that memory is available to your C heap, so if you call calloc 
again after the second readln, the total memory used should 
change very little.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list