[svn:parrot] r47135 - branches/gc_massacre/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun May 30 08:27:41 UTC 2010
Author: bacek
Date: Sun May 30 08:27:41 2010
New Revision: 47135
URL: https://trac.parrot.org/parrot/changeset/47135
Log:
Don't allocate objects smaller than sizeof(void*). Always allocate full 4kb page
Modified:
branches/gc_massacre/src/gc/pool_allocator.c
Modified: branches/gc_massacre/src/gc/pool_allocator.c
==============================================================================
--- branches/gc_massacre/src/gc/pool_allocator.c Sun May 30 08:26:56 2010 (r47134)
+++ branches/gc_massacre/src/gc/pool_allocator.c Sun May 30 08:27:41 2010 (r47135)
@@ -80,7 +80,7 @@
Parrot_gc_create_pool_allocator(size_t object_size)
{
ASSERT_ARGS(Parrot_gc_create_pool_allocator)
- const size_t attrib_size = object_size + sizeof (void *);
+ const size_t attrib_size = object_size < sizeof (void *) ? sizeof (void*) : object_size;
const size_t num_objs_raw =
(GC_FIXED_SIZE_POOL_SIZE - sizeof (Pool_Allocator_Arena)) / attrib_size;
const size_t num_objs = (num_objs_raw == 0)?(1):(num_objs_raw);
@@ -189,6 +189,10 @@
const size_t item_space = item_size * num_items;
const size_t total_size = sizeof (Pool_Allocator_Arena) + item_space;
+ /* Round up to 4kb */
+ if (total_size < GC_FIXED_SIZE_POOL_SIZE)
+ total_size = GC_FIXED_SIZE_POOL_SIZE;
+
Pool_Allocator_Arena * const new_arena = (Pool_Allocator_Arena *)mem_internal_allocate(
total_size);
More information about the parrot-commits
mailing list