From 64e7aedceef872e8f942cb8eb672d0bc32c13984 Mon Sep 17 00:00:00 2001 From: nari Date: Tue, 14 Feb 2012 09:11:24 +0000 Subject: * gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform sometime there should be `objs-=2` instead of `objs--`. patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ gc.c | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdfd848ebf..7cfa54fdb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Feb 14 18:07:20 2012 Narihiro Nakamura + + * gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform + sometime there should be `objs-=2` instead of `objs--`. + patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92 + Tue Feb 14 16:00:30 2012 Nobuyoshi Nakada * io.c (io_setstrbuf): cut down the buffer if longer. diff --git a/gc.c b/gc.c index 4c5a91ccbb..12dbb115f9 100644 --- a/gc.c +++ b/gc.c @@ -1165,9 +1165,7 @@ assign_heap_slot(rb_objspace_t *objspace) p = (RVALUE*)((VALUE)p + sizeof(struct heaps_header)); if ((VALUE)p % sizeof(RVALUE) != 0) { p = (RVALUE*)((VALUE)p + sizeof(RVALUE) - ((VALUE)p % sizeof(RVALUE))); - if ((HEAP_SIZE - HEAP_OBJ_LIMIT * sizeof(RVALUE)) < (size_t)((char*)p - (char*)membase)) { - objs--; - } + objs = (HEAP_SIZE - (size_t)((VALUE)p - (VALUE)membase))/sizeof(RVALUE); } lo = 0; -- cgit v1.2.3