Skip to content

Commit c6a541b

Browse files
committed
* 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. ruby#92 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent d081fff commit c6a541b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Tue Feb 14 18:07:20 2012 Narihiro Nakamura <authornari@gmail.com>
2+
3+
* gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform
4+
sometime there should be `objs-=2` instead of `objs--`.
5+
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
6+
17
Tue Feb 14 16:00:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
28

39
* io.c (io_setstrbuf): cut down the buffer if longer.

gc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,7 @@ assign_heap_slot(rb_objspace_t *objspace)
11651165
p = (RVALUE*)((VALUE)p + sizeof(struct heaps_header));
11661166
if ((VALUE)p % sizeof(RVALUE) != 0) {
11671167
p = (RVALUE*)((VALUE)p + sizeof(RVALUE) - ((VALUE)p % sizeof(RVALUE)));
1168-
if ((HEAP_SIZE - HEAP_OBJ_LIMIT * sizeof(RVALUE)) < (size_t)((char*)p - (char*)membase)) {
1169-
objs--;
1170-
}
1168+
objs = (HEAP_SIZE - (size_t)((VALUE)p - (VALUE)membase))/sizeof(RVALUE);
11711169
}
11721170

11731171
lo = 0;

0 commit comments

Comments
 (0)