File:  [parser3project] / parser3 / src / doc / memory.dox
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Tue Mar 30 08:32:17 2004 UTC (22 years, 2 months ago) by paf
Branches: MAIN
CVS tags: release_3_4_3, release_3_4_2, release_3_4_1, release_3_4_0, release_3_3_0, release_3_2_3, release_3_2_2, release_3_2_1, release_3_2_0, release_3_1_6, release_3_1_5, release_3_1_4, release_3_1_3, paf_left, HEAD
merged bugfixes from 3.1.2, changed version to 3.1.3beta

/**	@page Memory  Memory: work with memory

Parser in it's work with memory relies on garbage collection. See  http://www.hpl.hp.com/personal/Hans_Boehm/gc

Work with memory goes like this:
all allocations are in the end get to  pa_malloc pa_malloc_atomic, pa_realloc, pa_free functions; 
For C++ corresponding new operators are overloaded.
To allocate a memory in C++ style not for objects one should specify,
will the block to-be-allocated contain pointers,
new(UseGC) when "it will". new(PointerFreeGC) when "it will not".

For convinient memory allocation for objects there is root class PA_Object, 
overriding new operator, implementing it with pa_malloc, 
and providing wrappers for malloc/malloc_atomic/realloc/free.
It is recommended, where it is possible, to allocate memory in C++ style [using new operator],
exception can be made for a case where realloc is needed:
on many platforms new-operator changes the pointer, returned by new-operator-implementation allocator.
that is new+realloc / realloc+delete are not allowed.
*/

E-mail: