20,741
edits
| Line 278: | Line 278: | ||
= The pool manager = | = The pool manager = | ||
All high level type allocators (naNewString, naNewVector, naNewHash etc) make use of the naNew() call introduced earlier. | All high level type allocators (naNewString, naNewVector, naNewHash etc) make use of the naNew() call introduced earlier. | ||
naNew() doesn't directly allocate new memory from the heap using naAlloc(), but instead use the naGC_get() helper which manages memory from the global pools (i.e. preallocated memory for each type). | |||
For each native Nasal data type (scalars, vectors, hashes, funcs etc) , there are separate memory pools in globals->pools[n]. The index (n) is one of T_VEC, T_HASH, T_FUNC etc. | For each native Nasal data type (scalars, vectors, hashes, funcs etc) , there are separate memory pools in globals->pools[n]. The index (n) is one of T_VEC, T_HASH, T_FUNC etc. | ||