ruby-changes:22532
From: nari <ko1@a...>
Date: Mon, 13 Feb 2012 21:57:25 +0900 (JST)
Subject: [ruby-changes:22532] nari:r34581 (trunk): * gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used
nari 2012-02-13 21:57:16 +0900 (Mon, 13 Feb 2012) New Revision: 34581 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34581 Log: * gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used `sizeof(struct heaps_slot)` while heap is currently allocated with `struct heaps_header`. HEAP_BITMAP_LIMIT were calculated from `HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object, not one Bit. [Bug #6006] patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92 Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 34580) +++ ChangeLog (revision 34581) @@ -1,3 +1,13 @@ +Mon Feb 13 21:52:06 2012 Narihiro Nakamura <authornari@g...> + + * gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used + `sizeof(struct heaps_slot)` while heap is currently allocated + with `struct heaps_header`. + HEAP_BITMAP_LIMIT were calculated from + `HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object, + not one Bit. [Bug #6006] + patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92 + Mon Feb 13 18:30:32 2012 Nobuyoshi Nakada <nobu@r...> * io.c (io_setstrbuf): defer resizing buffer string until data is Index: gc.c =================================================================== --- gc.c (revision 34580) +++ gc.c (revision 34581) @@ -544,9 +544,10 @@ #define HEAP_ALIGN_MASK (~(~0UL << HEAP_ALIGN_LOG)) #define REQUIRED_SIZE_BY_MALLOC (sizeof(size_t) * 5) #define HEAP_SIZE (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC) +#define CEILMOD(i, mod) (((i) + (mod) - 1)/(mod)) -#define HEAP_OBJ_LIMIT (unsigned int)(HEAP_SIZE/sizeof(struct RVALUE) - (sizeof(struct heaps_slot)/sizeof(struct RVALUE)+1)) -#define HEAP_BITMAP_LIMIT (HEAP_OBJ_LIMIT/sizeof(uintptr_t)+1) +#define HEAP_OBJ_LIMIT (unsigned int)((HEAP_SIZE - sizeof(struct heaps_header))/sizeof(struct RVALUE)) +#define HEAP_BITMAP_LIMIT CEILMOD(HEAP_OBJ_LIMIT, sizeof(uintptr_t)*8) #define GET_HEAP_HEADER(x) (HEAP_HEADER(((uintptr_t)x) & ~(HEAP_ALIGN_MASK))) #define GET_HEAP_SLOT(x) (GET_HEAP_HEADER(x)->base) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/