20,741
edits
Line 416: | Line 416: | ||
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 | naNew() doesn't directly allocate new memory from the heap using naAlloc(), but instead uses 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. |