76 |
@code{scm_gc_unregister_collectable_memory}. |
@code{scm_gc_unregister_collectable_memory}. |
77 |
|
|
78 |
@deftypefn {C Function} void *scm_malloc (size_t @var{size}) |
@deftypefn {C Function} void *scm_malloc (size_t @var{size}) |
79 |
|
@deftypefnx {C Function} void *scm_calloc (size_t @var{size}) |
80 |
Allocate @var{size} bytes of memory and return a pointer to it. When |
Allocate @var{size} bytes of memory and return a pointer to it. When |
81 |
@var{size} is 0, return @code{NULL}. When not enough memory is |
@var{size} is 0, return @code{NULL}. When not enough memory is |
82 |
available, signal an error. This function runs the GC to free up some |
available, signal an error. This function runs the GC to free up some |
86 |
freed with @code{free}. There is no @code{scm_free} function to go |
freed with @code{free}. There is no @code{scm_free} function to go |
87 |
with @code{scm_malloc} to make it easier to pass memory back and forth |
with @code{scm_malloc} to make it easier to pass memory back and forth |
88 |
between different modules. |
between different modules. |
89 |
|
|
90 |
|
The function @code{scm_calloc} is similar to @code{scm_malloc}, but |
91 |
|
initializes the block of memory to zero as well. |
92 |
@end deftypefn |
@end deftypefn |
93 |
|
|
94 |
@deftypefn {C Function} void *scm_realloc (void *@var{mem}, size_t @var{new_size}) |
@deftypefn {C Function} void *scm_realloc (void *@var{mem}, size_t @var{new_size}) |
102 |
runs the GC to free up some memory when it deems it appropriate. |
runs the GC to free up some memory when it deems it appropriate. |
103 |
@end deftypefn |
@end deftypefn |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
@deftypefn {C Function} void scm_gc_register_collectable_memory (void *@var{mem}, size_t @var{size}, const char *@var{what}) |
@deftypefn {C Function} void scm_gc_register_collectable_memory (void *@var{mem}, size_t @var{size}, const char *@var{what}) |
109 |
Informs the GC that the memory at @var{mem} of size @var{size} can |
Informs the GC that the memory at @var{mem} of size @var{size} can |
110 |
potentially be freed during a GC. That is, announce that @var{mem} is |
potentially be freed during a GC. That is, announce that @var{mem} is |
134 |
|
|
135 |
@deftypefn {C Function} void *scm_gc_malloc (size_t @var{size}, const char *@var{what}) |
@deftypefn {C Function} void *scm_gc_malloc (size_t @var{size}, const char *@var{what}) |
136 |
@deftypefnx {C Function} void *scm_gc_realloc (void *@var{mem}, size_t @var{old_size}, size_t @var{new_size}, const char *@var{what}); |
@deftypefnx {C Function} void *scm_gc_realloc (void *@var{mem}, size_t @var{old_size}, size_t @var{new_size}, const char *@var{what}); |
137 |
Like @code{scm_malloc} or @code{scm_realloc}, but also call |
@deftypefnx {C Function} void *scm_gc_calloc (size_t @var{size}, const char *@var{what}) |
138 |
@code{scm_gc_register_collectable_memory}. Note that you need to pass |
Like @code{scm_malloc}, @code{scm_realloc} or @code{scm_calloc}, but |
139 |
the old size of a reallocated memory block as well. See below for a |
also call @code{scm_gc_register_collectable_memory}. Note that you |
140 |
motivation. |
need to pass the old size of a reallocated memory block as well. See |
141 |
|
below for a motivation. |
142 |
@end deftypefn |
@end deftypefn |
143 |
|
|
144 |
|
|
145 |
@deftypefn {C Function} void scm_gc_free (void *@var{mem}, size_t @var{size}, const char *@var{what}) |
@deftypefn {C Function} void scm_gc_free (void *@var{mem}, size_t @var{size}, const char *@var{what}) |
146 |
Like @code{free}, but also call @code{scm_gc_unregister_collectable_memory}. |
Like @code{free}, but also call @code{scm_gc_unregister_collectable_memory}. |
147 |
|
|