A persistent memory block can remain in memory beyond the lifetime of a run-time instance of the actor which allocates the block. This immediately raises the question of responsibility for freeing blocks of persistent memory. When a traditional ChorusOS 4.0 user actor terminates, any memory regions it allocated (using rgnAllocate(2K)) are automatically freed. Clearly, this simple rule makes little sense in the case of persistent memory blocks, which can survive beyond such a termination.
The hot restart feature provides two solutions to this problem:
Actors can explicitly free blocks of persistent memory using the API function pmmFree() or pmmFreeAll(). This is the only solution available for non-restartable actors which use persistent memory: for these actors, freeing persistent memory is entirely the programmer's responsibility.
If persistent memory needs to survive beyond the persistent lifetime of the allocating actor (that is, even after the actor has cleanly terminated), implementing this solution will require either careful application design or the presence of a garbage collection actor.
Explicit freeing of persistent memory blocks is described in the next section.
Hot restartable actors can benefit from an automatic clean-up mechanism provided by the Hot Restart Controller. This is described in more detail in "4.2.3 Freeing Persistent Memory".
In both cases, freeing a persistent memory block has the same effect: the block is immediately and permanently freed (cannot be retrieved), and the name which identified it can be re-used to identify a different memory block.