| parrotcode: Allocate and deallocate tracked resources | |
| Contents | C | 

src/gc/resources.c - Allocate and deallocate tracked resources


static void alloc_new_blockchar *why text is used for debugging.
static void *mem_allocate                    +-----------------+
                    |  ref_count   |f |    # GC header
  obj->bufstart  -> +-----------------+
                    |  data           |
                    v                 v
 * if PObj_is_COWable is set, then we have
   - a ref_count, {inc, dec}remented by 2 always
   - the lo bit 'f' means 'is being forwarded" - what TAIL_flag was
 * if PObj_align_FLAG is set, obj->bufstart is aligned like discussed above
 * obj->buflen is the usable length excluding the optional GC part.
static const char *buffer_locationb in one of the PMC registers. If the PMC is not located in one of the PMC registers of the current context, returns the string "???".
static void debug_print_bufb.
static void compact_poolvoid Parrot_go_collectcompact_pool.
static size_t aligned_sizebuffer which has nominal length len. The actual size in RAM of the Buffer might be different because of alignment issues.
static char *aligned_membuffer, which might not be the same as the pointer to buffeR because of memory alignment.
static size_t aligned_string_sizelen in RAM, accounting for alignment.
int Parrot_in_memory_poolbufstart pointer points to a location inside the memory pool. Returns 1 if the pointer is in the memory pool, 0 otherwise.
void Parrot_reallocatevoid Parrot_reallocate_stringstr->strstart to the new buffer location, str->bufused is not changed.
void Parrot_allocatesize has to be a multiple of the word size. PObj_buflen will be set to exactly the given size.
void Parrot_allocate_alignedsize will be rounded up and the address of the buffer will have the same alignment as a pointer returned by malloc(3) suitable to hold e.g. a FLOATVAL array.
void Parrot_allocate_stringsize. This function sets also str->strstart to the new buffer location, str->bufused is not changed.
static Memory_Pool *new_memory_poolMemory_Pool structures, and set some initial values. return a pointer to the new pool.
void Parrot_initialize_memory_poolsMemory_Pool structures, the general memory pool and the constant string pool. Create and initialize both pool structures, and allocate initial blocks of memory for both.
void Parrot_destroy_memory_poolsstatic void merge_pools*source pool into the *dest pool. The source pool is emptied, but is not destroyed here.
void Parrot_merge_memory_poolssource_interp into dest_interp.
include/parrot/resources.h, src/gc/memory.c.

Initial version by Dan on 2001.10.2.
| 
                     | 
                
                     
                 |