File:  [parser3project] / parser3 / src / doc / memory.dox
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Mon Apr 6 22:27:26 2015 UTC (11 years, 1 month ago) by moko
Branches: MAIN
CVS tags: release_3_5_1, release_3_5_0, release_3_4_6, release_3_4_5, release_3_4_4, HEAD
new(UseGC) replaced with new, malloc/strdup/free replaced with pa_ version and checks for accidental use of non-pa_ version added (related to issue #1018)

/**	@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 one should specify,
will the block contains pointers, use new when "it will" or new(PointerFreeGC) when "it will not".

For convinient memory allocation for objects there is root class PA_Object,
overriding new operator and check usage 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: