diff options
author | Andy Wingo <wingo@pobox.com> | 2014-04-28 18:51:21 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-04-28 18:51:21 +0200 |
commit | d7a67c3e918acd8ca46dc7792a8ca98b33cb94e8 (patch) | |
tree | 7ccf125978778d1ac6bb656245305c76db8e02d0 /doc/ref/api-memory.texi | |
parent | 475772ea57c97d0fa0f9ed9303db137d9798ddd3 (diff) | |
parent | 4338f2f91e1dd63a40384077d091295d90047926 (diff) | |
download | guile-d7a67c3e918acd8ca46dc7792a8ca98b33cb94e8.tar.gz |
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
.gitignore
doc/example-smob/Makefile
doc/ref/api-smobs.texi
doc/ref/libguile-concepts.texi
doc/ref/libguile-smobs.texi
libguile.h
libguile/finalizers.c
libguile/finalizers.h
libguile/goops.c
module/language/tree-il/compile-glil.scm
module/oop/goops.scm
Diffstat (limited to 'doc/ref/api-memory.texi')
-rw-r--r-- | doc/ref/api-memory.texi | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/doc/ref/api-memory.texi b/doc/ref/api-memory.texi index 01bfe81b2..0e37d16fc 100644 --- a/doc/ref/api-memory.texi +++ b/doc/ref/api-memory.texi @@ -112,15 +112,16 @@ functions for dynamic memory allocation that are integrated into the garbage collector and the error reporting system. Memory blocks that are associated with Scheme objects (for example a -smob) should be allocated with @code{scm_gc_malloc} or +foreign object) should be allocated with @code{scm_gc_malloc} or @code{scm_gc_malloc_pointerless}. These two functions will either return a valid pointer or signal an error. Memory blocks allocated this -way can be freed with @code{scm_gc_free}; however, this is not strictly -needed: memory allocated with @code{scm_gc_malloc} or -@code{scm_gc_malloc_pointerless} is automatically reclaimed when the -garbage collector no longer sees any live reference to it@footnote{In -Guile up to version 1.8, memory allocated with @code{scm_gc_malloc} -@emph{had} to be freed with @code{scm_gc_free}.}. +way may be released explicitly; however, this is not strictly needed, +and we recommend @emph{not} calling @code{scm_gc_free}. All memory +allocated with @code{scm_gc_malloc} or @code{scm_gc_malloc_pointerless} +is automatically reclaimed when the garbage collector no longer sees any +live reference to it@footnote{In Guile up to version 1.8, memory +allocated with @code{scm_gc_malloc} @emph{had} to be freed with +@code{scm_gc_free}.}. Memory allocated with @code{scm_gc_malloc} is scanned for live pointers. This means that if @code{scm_gc_malloc}-allocated memory contains a @@ -204,7 +205,9 @@ size of a reallocated memory block as well. See below for a motivation. @deftypefn {C Function} void scm_gc_free (void *@var{mem}, size_t @var{size}, const char *@var{what}) Explicitly free the memory block pointed to by @var{mem}, which was -previously allocated by one of the above @code{scm_gc} functions. +previously allocated by one of the above @code{scm_gc} functions. This +function is almost always unnecessary, except for codebases that still +need to compile on Guile 1.8. Note that you need to explicitly pass the @var{size} parameter. This is done since it should normally be easy to provide this parameter @@ -225,7 +228,7 @@ often (as appropriate). It is especially important to call this function when large unmanaged allocations, like images, may be freed by small Scheme allocations, like -SMOBs. +foreign objects. @end deftypefn |