diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-12 00:36:54 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-12 00:36:54 +0000 |
| commit | f47bdbc620155abd87a90d1bb0d4b59de38c3bf8 (patch) | |
| tree | 821d252ade8e1942f20425e05a6708f0d8b5e57a /gc.c | |
| parent | d21469f63eb60b5c17fe3d96ce3e0da0fd2deab2 (diff) | |
| download | ruby-f47bdbc620155abd87a90d1bb0d4b59de38c3bf8.tar.gz ruby-f47bdbc620155abd87a90d1bb0d4b59de38c3bf8.tar.xz ruby-f47bdbc620155abd87a90d1bb0d4b59de38c3bf8.zip | |
* ext/digest/digest.c (rb_digest_base_s_digest): add volatile to
protect temporary context object. [ruby-dev:27979]
* ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should
be called before actual variable initialization.
[ruby-dev:27986]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
| -rw-r--r-- | gc.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -106,6 +106,12 @@ rb_memerror(void) rb_exc_raise(nomem_error); } +#ifdef RUBY_GC_DEBUG +int always_gc = 0; +#else +# define always_gc 0 +#endif + void * ruby_xmalloc(size_t size) { @@ -117,7 +123,7 @@ ruby_xmalloc(size_t size) if (size == 0) size = 1; malloc_increase += size; - if (malloc_increase > malloc_limit) { + if (always_gc || malloc_increase > malloc_limit) { garbage_collect(); } RUBY_CRITICAL(mem = malloc(size)); @@ -165,6 +171,7 @@ ruby_xrealloc(void *ptr, size_t size) if (!ptr) return ruby_xmalloc(size); if (size == 0) size = 1; malloc_increase += size; + if (always_gc) garbage_collect(); RUBY_CRITICAL(mem = realloc(ptr, size)); if (!mem) { if (garbage_collect()) { @@ -394,7 +401,7 @@ rb_newobj(void) { VALUE obj; - if (!freelist && !garbage_collect()) + if ((always_gc || !freelist) && !garbage_collect()) rb_memerror(); obj = (VALUE)freelist; @@ -1018,6 +1025,7 @@ gc_sweep(void) unsigned long live = 0; mark_source_filename(ruby_sourcefile); + if (source_filenames) st_foreach(source_filenames, sweep_source_filename, 0); freelist = 0; |
