Memory Leak with C functions?
Namespace
rswhite4 at googlemail.com
Thu Nov 28 01:45:06 PST 2013
Code:
----
import std.stdio;
import core.stdc.stdlib : calloc, free;
void main() {
readln(); /// ~ 1332 K
void* ptr = .calloc(100_000, int.sizeof);
readln(); /// ~ 1720 K
free(ptr);
ptr = null;
readln(); /// Still ~ 1720 K
}
----
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?
More information about the Digitalmars-d-learn
mailing list