previous up next     contents index
Next: Scheme Environments Up: Memory Allocation Previous: Memory Allocation

Library Functions

 
void *  scheme_malloc(size_t n) 

Allocates n bytes of collectable memory.

 
void *  scheme_malloc_atomic(size_t n) 

Allocates n bytes of collectable memory containing no pointers visible to the garbage collector.

 
void *  scheme_malloc_stubborn(size_t n) 

Allocates n bytes of collectable memory that is intended for use with scheme_end_stubborn_change.

 
void *  scheme_malloc_uncollectable(size_t n) 

Allocates n bytes of uncollectable memory.

 
void *  scheme_malloc_eternal(size_t n) 

Allocates memory that will never be freed. Pointers to garbage-collectable objects in the memrory are invisible.

 
void   scheme_end_stubborn_change(void *p) 

Promises that the contents of p will never be changed.

 
void *  scheme_calloc(size_t num, size_t size) 

Allocates num * size bytes of memory.

 
char *  scheme_strdup(char *str) 

Copies the string str; the copy is collectable.

 
char *  scheme_strdup_eternal(char *str) 

Copies the string str; the copy will never be freed.

 
void   scheme_register_extension_global(void *ptr, long size) 

Registers a global variable in an extension that can contain Scheme pointers. The addres of the global is given in ptr, and its size in size.

 
void   scheme_weak_reference(void **p) 

Registers the pointer *p as a weak pointer; when no other (non-weak) pointers reference the same memory as *p references, then *p will be set to NULL by the garbage collector.

 
void   scheme_weak_reference_indirect(void **p, void *v) 

Like  scheme_weak_reference, but *p is cleared when there are no references to v.

 
void   scheme_register_finalizer(void *p, void (*f)(void *p, void *data), void *data, 
              void (**oldf)(void *p, void *data), void **olddata) 

Registers a callback function to be invoked when the memory p is about to be garbage-collected. The f argument is the callback function; when it is called, it will be passed the value p and the data pointer data; data can be anything -- it is only passed on to the callback function. If oldf and olddata are not NULL, then *oldf and *olddata are filled with with old callback information (f and data will override ths old callback).

 
void   scheme_collect_garbage() 

Forces an immediate garbage-collection.


previous up next     contents index
Next: Scheme Environments Up: Memory Allocation Previous: Memory Allocation

PLT