summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-14 09:11:24 +0000
committernari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-14 09:11:24 +0000
commit64e7aedceef872e8f942cb8eb672d0bc32c13984 (patch)
treee600d7a9d2edb6f550e3507a8c69f2c2613d3c57 /gc.c
parent52cb46337e9e5bd78f0a64a114ec8004173b2525 (diff)
* 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
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 1 insertions, 3 deletions
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;