Re: Allocators and memory reclamation



On 29 Sty, 01:41, Robert A Duff <bobd...@xxxxxxxxxxxxxxxxxxxx> wrote:

Finalization of heap objects happens when you do
Unchecked_Deallocation. In addition, when an access type goes
out of scope, all remaining objects (the ones you did not
Unchecked_Deallocate) are finalized in an arbitrary order,
but this does not free the memory.
[...]
In implementation terms, each finalizable heap object is
chained onto a doubly-linked list. U_D removes the object
from the list, finalizes it, and frees the memory.
When the access type goes out of scope, the implementation
walks down the list and finalizes everything on it.
[...]

This, and the replies from Adam and Dmitry give me the complete
picture of how it works. Thanks for the explanation.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com
.



Relevant Pages

  • Re: memory management
    ... Unless the access type goes out of scope in which case the memory is ... > access object goes out of scope, ...
    (comp.lang.ada)
  • Re: Allocators and memory reclamation
    ... storage is taken from the storage pool associated with the Int_Ptr ... the access type itself goes out of scope and it is also when the ... As a result no memory is leaked in the above code ...
    (comp.lang.ada)