1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c: count only freed object as freelist size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-08-13 10:42:57 +00:00
parent 38c94fa149
commit 96af71a288
2 changed files with 10 additions and 7 deletions

View file

@ -1,3 +1,7 @@
Wed Aug 13 19:40:12 2008 Koichi Sasada <ko1@atdot.net>
* gc.c: count only freed object as freelist size.
Wed Aug 13 18:34:22 2008 Shugo Maeda <shugo@ruby-lang.org>
* marshal.c (marshal_load): set arg.untrust properly.

13
gc.c
View file

@ -1636,7 +1636,7 @@ gc_sweep(rb_objspace_t *objspace)
final_list = deferred_final_list;
deferred_final_list = 0;
for (i = 0; i < heaps_used; i++) {
int n = 0;
int free_num = 0, final_num = 0;
RVALUE *free = freelist;
RVALUE *final = final_list;
int deferred;
@ -1654,11 +1654,12 @@ gc_sweep(rb_objspace_t *objspace)
p->as.free.flags |= FL_MARK;
p->as.free.next = final_list;
final_list = p;
final_num++;
}
else {
add_freelist(objspace, p);
free_num++;
}
n++;
}
else if (BUILTIN_TYPE(p) == T_DEFERRED) {
/* objects to be finalized */
@ -1670,21 +1671,19 @@ gc_sweep(rb_objspace_t *objspace)
}
p++;
}
if (n == heaps[i].limit && freed > do_heap_free) {
if (final_num + free_num == heaps[i].limit && freed > do_heap_free) {
RVALUE *pp;
int f_count = 0;
for (pp = final_list; pp != final; pp = pp->as.free.next) {
f_count++;
RDATA(pp)->dmark = (void *)&heaps[i];
pp->as.free.flags |= FL_SINGLETON; /* freeing page mark */
}
heaps[i].limit = f_count;
heaps[i].limit = final_num;
freelist = free; /* cancel this page from freelist */
}
else {
freed += n;
freed += free_num;
}
}
GC_PROF_SET_MALLOC_INFO;