When is it time for a 1.0 feature freeze?
Sean Kelly
sean at f4.ca
Sun Sep 3 11:03:00 PDT 2006
Stewart Gordon wrote:
> Walter Bright wrote:
> <snip>
>> 1) Few programmers realize that C/C++'s malloc/free/new/delete *never*
>> (and I emphasize NEVER) return memory to the operating system. All
>> free/delete do is return memory to the memory pool managed by the
>> runtime library, not the operating system. In order to actually return
>> memory to the operating system, one has to write their own memory
>> management code, which is a significant (and necessarily non-portable)
>> effort. Hardly anyone does that.
> <snip>
>
> Never? I can't believe you've tried every implementation out there,
> including your own, and found the same.
>
> Or does the spec forbid free or delete to return memory to the OS? I
> can't for the life of me see why this would be.
Memory can only be allocated and freed in pages, and a memory page can
obviously only be returned to the OS if it is completely empty. Some
allocators will do this (HOARD, for example), but they typically try to
re-use them first. Generally, only pages used for huge allocations are
returned to the OS when they are freed, and I think DMD's GC does this
as well.
Sean
More information about the Digitalmars-d
mailing list