summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-10-28 01:42:29 +0100
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:43 +0200
commite637f6ab757ec031eefc2e07af254a4198f5da7a (patch)
tree8b2fbc85eace0cb5239843b2f8de1ab29c224515 /malloc.c
parentd60024dba01d3a856a4cd7d99f34b7ee52f5318a (diff)
2008-10-27 Hans Boehm <Hans.Boehm@hp.com>
* win32_threads.c (GC_get_stack_min, GC_may_be_in_stack): Add one entry VirtualQuery cache, I_HOLD_LOCK assertions. (GC_push_stack_for, GC_get_next_stack) : Hopefully fix WINCE support. 2008-10-27 Hans Boehm <Hans.Boehm@hp.com> (Thanks to Klaus Treichel.) * finalize.c (GC_general_register_disappearing_link): Add assertion. * malloc.c (GC_generic_malloc): Round lb to granules, not words. * mallocx.c (GC_generic_malloc_ignore_off_page): Round lb to granules, not words.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/malloc.c b/malloc.c
index 9928ea2..88d5619 100644
--- a/malloc.c
+++ b/malloc.c
@@ -159,12 +159,13 @@ void * GC_generic_malloc(size_t lb, int k)
result = GC_generic_malloc_inner((word)lb, k);
UNLOCK();
} else {
- size_t lw;
+ size_t lg, lw;
size_t lb_rounded;
word n_blocks;
GC_bool init;
- lw = ROUNDED_UP_WORDS(lb);
- lb_rounded = WORDS_TO_BYTES(lw);
+ lg = ROUNDED_UP_GRANULES(lb);
+ lw = GRANULES_TO_WORDS(lg);
+ lb_rounded = GRANULES_TO_BYTES(lg);
n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded);
init = GC_obj_kinds[k].ok_init;
LOCK();