summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog6
-rw-r--r--gc.c4
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 <authornari@gmail.com>
+
+ * 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 <nobu@ruby-lang.org>
* 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;