DMD memory management

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 15 03:07:46 PDT 2015


On 15-Jun-2015 10:20, Shachar Shemesh wrote:
> On 14/06/15 20:01, bitwise wrote:
>> On Sun, 14 Jun 2015 12:52:47 -0400, ketmar <ketmar at ketmar.no-ip.org>
>> wrote:
>
>>> so it's by design.
>>
>> Ok, makes sense ;)
>>
>>    Bit
>
> Well, sortof.
>
> It makes sense, until you try to compile a program that needs more
> memory than your computer has. Then, all of a sudden, it completely and
> utterly stops making sense.

Truth be told it never made any sense - it only suitable for immutables 
- AST, ID pool and few others. For instance, lots and lots of AA-s are 
short-lived per analyzed scope.

Even for immutables using region-style allocator with "releaseAll" would 
be much safer strategy with same gains. Also never deallocating means we 
can't use tooling such as valgrind to pin down real memory leaks.

>
> Hint: when you need to swap out over 2GB of memory (with 16GB of
> physical ram installed), this strategy completely and utterly stops
> making sense.
>
Agreed.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list