NAME ^

src/res_lea.c - Resource allocation using malloc

DESCRIPTION ^

This file provides alternative implementations of memory allocation function found in src/resources.c. It is used if Configure.pl is passed the --gc=malloc or --gc=malloc-trace options.

The "lea" in the file name refers to Doug Lea, who wrote malloc implementation found in src/malloc.c.

Functions ^

void Parrot_go_collect(Interp *interp)

Does nothing other than increment the interpreter's collect_runs count.

static PARROT_INLINE void *xmalloc(size_t size)

Obtains the memory from malloc() and returns it. Panics if there is no memory available.

static PARROT_INLINE void *xcalloc(size_t n, size_t size)

Obtains the memory from calloc() and returns it. Panics if there is no memory available.

static PARROT_INLINE void *xrealloc(void *p, size_t size)

Reallocates the memory with realloc() and returns it. Panics if there is no memory available.

void *Parrot_reallocate(Interp *interp, void *from, size_t size)

COWable objects (strings or Buffers) use an INTVAL at bufstart for refcounting in DOD. bufstart is incremented by that INTVAL.

void *Parrot_allocate(Interp *interp, void *buffer, size_t size)

Allocates and returns the required memory. size is the number of bytes of memory required.

void *Parrot_allocate_zeroed(Interp *interp, void *buffer, size_t size)

Allocates, zeros and returns the required memory. size is the number in bytes of memory required.

void *Parrot_reallocate_string(Interp *interp, STRING *str, size_t size)

Reallocates the string buffer in *str and returns it. size is the number of bytes memory required.

void *Parrot_allocate_string(Interp *interp, STRING *str, size_t size)

Allocates the string buffer in *str and returns it. size is the number bytes of memory required.

void Parrot_initialize_memory_pools(Interp *interp)

Does nothing.

void Parrot_destroy_memory_pools(Interp *interp)

Does nothing.

SEE ALSO ^

config/auto/gc.pl, src/malloc.c, include/parrot/resources.h.


parrot