std.container.Array/RefCounted(T) leaking memory?
jessekphillips+D at gmail.com
Thu Jan 13 14:25:19 PST 2011
Thanks very nice info, just two guys babbling about things they've only read I guess, but you seem much better informed.
Steven Schveighoffer Wrote:
> I think all memory is allocated/deallocated from the OS via the sbrk/brk
> system call:
> brk() and sbrk() change the location of the program break,
> defines the end of the process's data segment (i.e., the program
> is the first location after the end of the uninitialized data
> Increasing the program break has the effect of allocating memory to
> process; decreasing the break deallocates memory.
> So you can only ever add to the *end* of memory, and you can only ever
> deallocate from the *end*. And the OS doesn't ever just jump in and claim
> memory, you have to tell it that you are deallocating memory.
> Which means, if you say allocated 100MB, and wanted to deallocate the
> first 99MB, you still couldn't release any back to the OS.
> A moving GC would allow for more memory to be freed, but we aren't there
> Of course, I could be completely wrong about all this, I've never really
> used sbrk or brk :)
More information about the Digitalmars-d-learn