parrotcode: Allocate and deallocate tracked resources | |
Contents | C |
src/resources.c - Allocate and deallocate tracked resources
static void *alloc_new_block(Interp *interpreter, size_t size, struct Memory_Pool *pool)
static void *mem_allocate(Interp *interpreter, size_t *req_size, struct Memory_Pool *pool, size_t align_1)
align_1
sets the size,
but not the alignment of the memory block we are about to allocate.
The alignment of this block is currently determined by the align_1
sent in by the previous allocation.
See http://archive.develooper.com/perl6-internals%40perl.org/msg12310.html for details.
Currently,
we work around it by forcing all the *ALIGNMENT
#define
s in <include/parrot/file.h> to be the same.static void compact_pool(Interp *interpreter, struct Memory_Pool *pool)
void Parrot_go_collect(Interp *interpreter)
void *Parrot_reallocate(Interp *interpreter, void *from, size_t tosize)
void *
because we may take a STRING
or something,
and C doesn't subclass.void *Parrot_reallocate_string(Interp *interpreter, STRING *str, size_t tosize)
STRING
pointer,
and a new size.
The destination may be bigger,
since we round up to the allocation quantum.void *Parrot_allocate(Interp *interpreter, void *buffer, size_t size)
void *Parrot_allocate_zeroed(Interp *interpreter, void *buffer, size_t size)
Parrot_allocate()
,
which also returns zeroed memory.void *Parrot_allocate_string(Interp *interpreter, STRING *str, size_t size)
static struct Memory_Pool *new_memory_pool(size_t min_block, compact_f compact)
void Parrot_initialize_memory_pools(Interp *interpreter)
void Parrot_destroy_memory_pools(Interp *interpreter)
include/parrot/resources.h, src/memory.c.
Initial version by Dan on 2001.10.2.
|