why allocators are not discussed here

bearophile bearophileHUGS at lycos.com
Tue Jun 25 16:37:00 PDT 2013


cybervadim:

> From my experience all objects may be divided into 2 categories
> 1. temporaries. Program usually have some kind of event loop. 
> During one iteration of this loop some temporary objects are 
> created and then discarded. The ideal case for stack (or ranged 
> or area) allocator, where you define allocator at the beginning 
> of the loop cycle, use it for all temporaries, then free all 
> the memory in one go at the end of iteration.
> 2. containers. Program receives an event from the outside and 
> puts some data into container OR update the data if the record 
> already exists.
> The important thing here is - when updating the data in 
> container, you may want to resize the existing area.

Many garbage collectors use the same idea (and manage it 
automatically), with two or three different generations:

http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29#Generational_GC_.28ephemeral_GC.29

Bye,
bearophile


More information about the Digitalmars-d mailing list