summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
Commit message (Expand)AuthorAgeFilesLines
* Deprecate dynamic roots...* libguile/root.h: * libguile/root.c: Remove these files. * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_cwdr, scm_call_with_dynamic_root) (scm_dynamic_root, scm_apply_with_dynamic_root): Deprecate. Remove all root.h usage, which was vestigial. * module/ice-9/serialize.scm: Use (current-thread) instead of (dynamic-root). Andy Wingo2016-11-211-1/+0
* Merge branch 'stable-2.0'...Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c Mark H Weaver2014-04-251-3/+2
|\
| * Rely on Gnulib for <unistd.h>....* libguile/async.c: * libguile/backtrace.c: * libguile/error.c: * libguile/filesys.c: * libguile/fports.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/init.c: * libguile/ioext.c: * libguile/load.c: * libguile/mallocs.c: * libguile/mkstemp.c: * libguile/ports.c: * libguile/posix.c: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/rw.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/simpos.c: * libguile/socket.c: * libguile/stime.c: * libguile/strports.c: * libguile/threads.c: Unconditionally include <unistd.h>. Mark H Weaver2014-02-271-3/+2
* | Out-of-memory situations raise exceptions instead of aborting...* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory handler that raises an unwind-only out-of-memory exception. (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to print to the current warning port, if the current warning port is a file port. (scm_gc_after_nonlocal_exit): New interface. Should be called after a nonlocal return to potentially collect memory; otherwise allocations could try to expand again when they should collect. * libguile/continuations.c (scm_i_make_continuation): * libguile/eval.c (eval): * libguile/throw.c (catch): * libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after nonlocal returns. * libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework to avoid allocating memory. (scm_report_out_of_memory): New interface. (scm_init_throw): Pre-allocate the arguments for stack-overflow and out-of-memory errors. * module/ice-9/boot-9.scm: Add an out-of-memory exception printer. * module/system/repl/error-handling.scm (call-with-error-handling): Add out-of-memory to the report-keys set. * libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if realloc fails. * libguile/error.h: * libguile/error.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_memory_error): Deprecate. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-out-of-memory: New test case. Andy Wingo2014-03-221-2/+5
* | Remove private-gc.h...* libguile/simpos.c (scm_getenv_int): Move here, from gc.c. * libguile/private-gc.h: Remove, unused. * libguile/simpos.h: Move scm_getenv_int declaration here. * libguile/vm.c: * libguile/gc.c: Adapt scm_getenv_int users. * libguile/gc-malloc.c: * libguile/load.c: * libguile/script.c: Remove private-gc includes from non-users of scm_getenv_int. * libguile/Makefile.am: Adapt. Andy Wingo2013-11-281-2/+0
* | Remove tests and shims for pre-7.2 bdw-gc....* configure.ac: Remove checks for symbols present in bdw-gc 7.2. * libguile/finalizers.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/guardians.c: * libguile/scmsigs.c: * libguile/threads.c: Remove shims. Andy Wingo2013-11-221-5/+1
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c Andy Wingo2012-02-081-32/+55
|\|
| * Fix --enable-debug-malloc...* libguile/gc-malloc.c (do_realloc, do_calloc, do_gc_malloc) (do_gc_malloc_atomic, do_gc_realloc, do_gc_free): Wrap the allocators in helper methods. The non-GC allocators call scm_gc_register_allocation, and the GC allocators ensure that gc_malloc returns a nonzero value. (scm_realloc, scm_calloc): Allow NULL return for malloc(0). It is permitted by POSIX. Don't wrap in a SCM_SYSCALL; the only possible errno is ENOMEM. (scm_gc_malloc_pointerless, scm_gc_malloc, scm_gc_calloc): (scm_gc_realloc, scm_gc_free, scm_gc_strndump): Use the wrappers. Don't call the debug-malloc registrations and deregistrations, as it is neither mandatory nor advised to call scm_gc_free. Fixes compilation with debug-malloc. (scm_must_free): Don't scm_malloc_unregister. Andy Wingo2012-02-051-37/+56
* | Merge commit 'f78a1ccede02ccad89d6c91a6b297f1f14a30907'Andy Wingo2012-01-101-4/+1
|\|
| * stdlib.h, not malloc.h...* configure.ac: Remove check for malloc.h. * libguile/gc-malloc.c: * libguile/gc.c: * libguile/mallocs.c: * libguile/smob.c: Use stdlib instead of malloc.h. Andy Wingo2011-12-221-4/+1
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: configure.ac Andy Wingo2011-12-131-0/+4
|\|
| * fix compilation with gc 7.1...* configure.ac: Add checks for GC_gcollect_and_unmap and GC_get_unmapped_bytes. * libguile/gc-malloc.c (scm_realloc): GC_gcollect() if we don't have GC_gcollect_and_unmap. * libguile/gc.c (GC_get_heap_usage_safe): Likewise, don't GC_get_unmapped_bytes if the function doesn't exist. Chris K. Jester-Young2011-12-081-0/+4
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/deprecation.c libguile/load.c libguile/print.c Andy Wingo2011-12-061-1/+2
|\|
| * scm_gc_register_collectable_memory calls scm_gc_register_allocation...* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Call scm_gc_register_allocation. Andy Wingo2011-12-021-1/+2
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm Andy Wingo2011-12-011-1/+3
|\|
| * attempt to handle steady-state mallocations better...* libguile/gc-malloc.c (scm_realloc): Call the new scm_gc_register_allocation() here. If we have to collect, do a GC_gcollect_and_unmap. * libguile/gc.c (scm_gc_register_allocation): Add a routine to track steady-state mallocation, and cause gc to run if there is a high mallocation rate. (adjust_gc_frequency): Reset the bytes-until-GC countdown timer. Andy Wingo2011-11-291-1/+3
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: GUILE-VERSION libguile/deprecated.c libguile/gc-malloc.c module/language/tree-il/peval.scm Andy Wingo2011-10-271-2/+3
|\|
| * Fix compilation with `--enable-debug-malloc'....* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Add the missing second argument in the call to scm_malloc_register. Bake Timmons2011-10-221-2/+3
* | remove weak pairs, rewrite weak vectors...* libguile/weak-vector.c: * libguile/weak-vector.h: Renamed from weaks.[ch]. Remove weak pairs. They were not safe to access with `car' and `cdr'. Remove weak alist vectors, as we have weak tables and sets. Reimplement weak vectors, moving the implementation here. * libguile/vectors.c: * libguile/vectors.h: Remove the extra header word. Use scm_c_weak_vector_ref / scm_c_weak_vector_set_x to access weak vectors. * libguile/snarf.h: Remove the extra header word in vectors. * libguile/threads.c (do_thread_exit, fat_mutex_lock, fat_mutex_unlock): Instead of weak pairs, store thread-owned mutexes in a list of one-element weak vectors. * libguile/guardians.c (finalize_guarded): Similarly, store object guardians in a list of one-element weak vectors. * libguile/modules.c (scm_module_reverse_lookup): We no longer need to handle the case of weak references. * libguile/print.c (iprin1): Use the standard vector accessor to print vectors. * libguile.h: * libguile/Makefile.am: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/goops.c: * libguile/init.c: * libguile/objprop.c: * libguile/struct.c: Update includes. * module/ice-9/weak-vector.scm: Load weak vector definitions using an extension instead of %init-weaks-builtins. * test-suite/tests/weaks.test: Use the make-...-hash-table names instead of the old alist vector names. Andy Wingo2011-10-241-1/+0
* | remove all deprecated code...* libguile/async.c: * libguile/async.h: * libguile/debug.h: * libguile/deprecated.c: * libguile/deprecated.h: * libguile/evalext.h: * libguile/gc-malloc.c: * libguile/gc.h: * libguile/gen-scmconfig.c: * libguile/numbers.c: * libguile/ports.c: * libguile/ports.h: * libguile/procprop.c: * libguile/procprop.h: * libguile/read.c: * libguile/socket.c: * libguile/srfi-4.h: * libguile/strings.c: * libguile/strings.h: * libguile/tags.h: * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm: Remove all deprecated code. CPP defines that were not previously issuing warnings were changed so that their expansions would indicate the replacement forms to use, e.g. scm_sizet__GONE__REPLACE_WITH__size_t. The two exceptions were SCM_LISTN, which did not produce warnings before, and the string-filter argument order stuff. Drops the initial dirty memory usage of Guile down to 2.8 MB on my machine, from 4.4 MB. Andy Wingo2011-05-121-104/+1
|/
* make-string et al nulls memory if not given an initializer...* libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the memory block, so users need to make sure it is initialized. * libguile/bitvectors.c (scm_c_make_bitvector): * libguile/bytevectors.c (scm_make_bytevector): * libguile/strings.c (scm_c_make_string): If no initializer is given, initialize the bytes to 0. Prevents information leakage if an app uses make-string et al without initializers. * libguile/foreign.c (make_cif): Initialize this too, to prevent leakage in the struct holes. Paranoia... Andy Wingo2010-12-041-2/+4
* fix bug in scm_must_free...* libguile/gc-malloc.c: Update a comment. (scm_must_free): Must be able to free memory allocated with scm_must_malloc, and thus must be GC_FREE, not free. Andy Wingo2010-03-291-11/+5
* remove out-of-date comment in scm_gc_malloc...* libguile/gc-malloc.c (scm_gc_malloc): Remove out-of-date comment. Andy Wingo2010-03-291-12/+1
* Fix stylistic issues revealed by "make syntax-check"....* libguile/gc-malloc.c (scm_must_free): Remove unnecessary `if' before `free ()'. * libguile/stime.c (scm_localtime, scm_mktime): Likewise. * libguile/eval.i.c (ceval): Don't cast the result of alloca(3). * libguile/i18n.c (SCM_STRING_TO_U32_BUF): Likewise. * test-suite/standalone/test-unwind.c: Likewise. * libguile/strings.c (scm_i_deprecated_string_chars): Don't end error message in period. Ludovic Courtès2009-11-171-7/+2
* Don't use memset(3) after `GC_MALLOC ()' calls....* libguile/gc-malloc.c (scm_gc_calloc): Don't use memset(3) as it's not needed. Reported by Andy Wingo. Ludovic Courtès2009-10-261-4/+2
* Resolve warning in gcc-4.3 about transposed parameters passed to memset...* libguile/gc-malloc.c (scm_gc_calloc): Add explicit check on size parameter Signed-off-by: Ludovic Courtès <ludo@gnu.org> Julian Graham2009-10-251-1/+2
* Use pointer-less memory for `scm_gc_strdup ()'....* libguile/gc-malloc.c (scm_gc_strndup): Use `GC_MALLOC_ATOMIC ()' instead of `GC_MALLOC ()'. Ludovic Courtès2009-10-151-1/+1
* Remove deprecated variables/macros from the GC headers....* libguile/deprecated.c (scm_mtrigger, scm_mallocated, scm_max_segment_size): New global variables, from gc.c. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New stubs. * libguile/deprecated.h (scm_mallocated, scm_mtrigger, scm_max_segment_size): New declarations. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New declarations. * libguile/gc-malloc.c (scm_i_minyield_malloc): Remove. (scm_gc_init_malloc): Remove references to `scm_i_minyield_malloc' and `scm_mtrigger'. * libguile/gc.c (scm_mtrigger, scm_mallocated): Remove. (scm_init_storage): Remove reference to `SCM_HEAP_SEG_SIZE'. * libguile/gc.h (scm_max_segment_size, SCM_SET_FREELIST_LOC, SCM_FREELIST_LOC, scm_i_master_freelist, scm_i_master_freelist2, scm_mallocated, scm_mtrigger): Remove. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[SCM_ENABLE_DEPRECATED && GUILE_DEBUG_FREELIST]: Remove. * libguile/private-gc.h (SCM_DEFAULT_INIT_HEAP_SIZE_1, SCM_DEFAULT_MIN_YIELD_1, SCM_DEFAULT_MIN_YIELD_2, DEFAULT_SWEEP_AMOUNT, SCM_DEFAULT_MAX_SEGMENT_SIZE, SCM_MIN_HEAP_SEG_SIZE, SCM_HEAP_SEG_SIZE, SCM_GC_CARD_BVEC_SIZE_IN_LONGS, SCM_GC_IN_CARD_HEADERP): Remove. (scm_getenv_int): Made internal. (scm_i_marking, scm_mark_all, scm_i_deprecated_memory_return, scm_i_find_heap_calls, scm_gc_init_malloc, scm_gc_init_freelist, scm_gc_init_segments, scm_gc_init_mark): Remove declarations. * libguile/gc-segment-table.c: Remove, finally. Ludovic Courtès2009-08-281-21/+0
* Merge branch 'master' into boehm-demers-weiser-gc...Conflicts: libguile/Makefile.am libguile/bytevectors.c libguile/gc-card.c libguile/gc-mark.c libguile/programs.c libguile/srcprop.c libguile/srfi-14.c libguile/symbols.c libguile/threads.c libguile/unif.c libguile/vm.c Ludovic Courtès2009-08-281-4/+6
|\
| * Merge wip-array refactor, up to cd43fdc5b7a7c...Conflicts: NEWS libguile/print.c Andy Wingo2009-08-251-2/+2
| |\
| | * rename unif.[ch] to arrays.[ch]...* libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/arrays.c: * libguile/arrays.h: Rename unif.[ch] to arrays.[ch]. * libguile.h: * libguile/array-handle.c: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/eq.c: * libguile/gc-card.c: * libguile/gc-malloc.c: * libguile/gc-mark.c: * libguile/gc.c: * libguile/init.c: * libguile/inline.h: * libguile/print.c: * libguile/random.c: * libguile/read.c: * libguile/socket.c: * libguile/sort.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/strports.c: * libguile/vectors.c: * libguile/vectors.h: Update includers. Andy Wingo2009-07-191-2/+2
| * | Type-limits error in GC environment initialization...* libguile/gc-malloc.c (scm_gc_init_malloc): GUILE_INIT_MALLOC_LIMIT is cast to unsigned then tested as if it were still signed Michael Gran2009-08-201-2/+4
| |/
* | Merge branch 'master' into boehm-demers-weiser-gc...Conflicts: lib/Makefile.am libguile/Makefile.am libguile/frames.c libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc_os_dep.c libguile/load.c libguile/macros.c libguile/objcodes.c libguile/programs.c libguile/strings.c libguile/vm.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/inline.m4 Ludovic Courtès2009-08-181-6/+7
|\|
| * Change Guile license to LGPLv3+...(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* ) Neil Jerram2009-06-171-6/+7
* | Merge branch 'master' into boehm-demers-weiser-gc...Conflicts: lib/Makefile.am libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/private-gc.h m4/.cvsignore m4/gnulib-cache.m4 m4/gnulib-comp.m4 Ludovic Courtès2008-09-131-1/+1
|\|
| * Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès2008-09-131-1/+1
* | Merge branch 'master' into boehm-demers-weiser-gc...Conflicts: libguile/Makefile.am libguile/coop-defs.h libguile/gc-card.c libguile/gc-freelist.c libguile/gc-malloc.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/hashtab.c libguile/hashtab.h libguile/inline.h libguile/private-gc.h libguile/struct.c libguile/struct.h libguile/threads.c libguile/threads.h libguile/vectors.h libguile/weaks.h test-suite/tests/gc.test Ludovic Courtès2008-09-101-4/+4
|\|
| * Style nitpicks: space before () in function call.Han-Wen Nienhuys2008-08-211-5/+5
| * If realloc() fails in scm_realloc, then do a complete GC with complete...sweep directly. Han-Wen Nienhuys2008-08-161-13/+9
| * Garbage collection cleanup....* New file gc-segment-table.c: hold code for the segment table. * Remove data that might be out of date; remove scm_i_adjust_min_yield(). We don't store min_yields, since they are only accurate at one point in time (when the sweep finishes). We decide the min yield at that point from min_yield_fraction and freelist->collected / freelist->swept * Introduce scm_i_gc_heap_size_delta() replacing scm_i_gc_grow_heap_p(). * Remove foo_1 fields containing penultimate results. * After GC, count mark bit vector to discover number of live objects. This simplifies hairy updates. * Many formatting and layout cleanups. * Fix in scm_i_sweep_card(): return the length of free_list returned, rather than number of deleted objects. * For mtrigger GCs: do not also run a full sweep after the gc() call, as this is inconsistent with lazy sweeping. * Remove scm_i_make_initial_segment(). * Use calloc in scm_i_make_empty_heap_segment() to save on initialization code. * New function scm_i_sweep_for_freelist() which sweeps, with proper statistic variable updates. * New segments are conceptually blocks with 100% reclaimable cells. * Remove some useless constants/comments: SCM_HEAP_SIZE, SCM_INIT_HEAP_SIZE, SCM_EXPHEAP, SCM_HEAP_SEG_SIZE * Do not increment scm_cells_allocated() from the scm_[double]cell(). This would be a race condition. * Move some deprecation checks in separate functions to not distract from main code flow. Han-Wen Nienhuys2008-08-161-10/+14
| * Release stuff: missing NEWS and 2007/2008 copyrights.Neil Jerram2008-02-151-1/+1
| * (scm_gc_malloc): Return NULL if requested size is 0....(scm_gc_free): Don't call `free' if mem is NULL. Neil Jerram2008-02-061-2/+3
* | scm_gc_malloc: Handle zero-octet allocations....* libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to `GC_MALLOC ()' when SIZE is zero. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2 Ludovic Courtes2008-09-101-1/+8
* | Added `scm_gc_malloc_pointerless ()', equivalent to `GC_MALLOC_ATOMIC ()'....* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Tidied. (scm_gc_unregister_collectable_memory): Likewise. (scm_gc_malloc_pointerless): New. * libguile/gc.h (scm_gc_malloc_pointer_less): New declaration. * libguile/strings.c (make_stringbuf): Use it. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-5 Ludovic Courtes2008-09-051-1/+10
* | Merge from lcourtes@laas.fr--2005-mobile...Patches applied: * lcourtes@laas.fr--2005-mobile/guile-core--boehm-gc--1.9 (base, patch 1) - tag of lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--base-0 - Initial hack for Boehm's GC support: nothing works. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-1 Ludovic Courtes2008-09-051-143/+10
|/
* merge from 1.8 branchKevin Ryde2006-04-171-1/+11
* Ludovic's patch for scm_t_sweep_statistics.Han-Wen Nienhuys2006-02-141-4/+6
* The FSF has a new address.Marius Vollmer2005-05-231-1/+1
* * gc.h, gc.c (SCM_FREECELL_P): Removed for good....(scm_block_gc, scm_gc_heap_lock): Removed. Removed all uses. (scm_gc_running_p): Now a macro that refers to the scm_i_thread field. (scm_i_sweep_mutex): Now a non-recursive mutex. GC can not happen recursively. (scm_igc, scm_i_gc): Renamed former to latter. Changed all uses. Do not lock scm_i_sweep_mutex, which is now non-recursive, or set scm_gc_running_p. Do not run the scm_after_gc_c_hook. (scm_gc): Lock scm_i_sweep_mutex, set scm_gc_running_p and run the scm_after_gc_c_hook here. (scm_gc_for_new_cell): Set scm_gc_running_p here and run the scm_after_gc_c_hook when a full GC has in fact been performed. (scm_i_expensive_validation_check): Call scm_gc, not scm_i_gc. * gc-segment.c (scm_i_get_new_heap_segment): Do not check scm_gc_heap_lock. * gc-malloc.c (scm_realloc, increase_mtrigger): Set scm_gc_running_p while the scm_i_sweep_mutex is locked. Marius Vollmer2005-03-101-4/+9
* See ChangeLog from 2005-03-02.Marius Vollmer2005-03-021-12/+10