[svn:parrot] r45715 - branches/compact_pool_revamp/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Apr 16 15:31:07 UTC 2010


Author: bacek
Date: Fri Apr 16 15:31:06 2010
New Revision: 45715
URL: https://trac.parrot.org/parrot/changeset/45715

Log:
Use more presize calculation of used memory

Modified:
   branches/compact_pool_revamp/src/gc/alloc_resources.c

Modified: branches/compact_pool_revamp/src/gc/alloc_resources.c
==============================================================================
--- branches/compact_pool_revamp/src/gc/alloc_resources.c	Fri Apr 16 15:18:14 2010	(r45714)
+++ branches/compact_pool_revamp/src/gc/alloc_resources.c	Fri Apr 16 15:31:06 2010	(r45715)
@@ -498,7 +498,6 @@
                         sizeof (Memory_Block**) * total_blocks);
 
     /* Calculate blocks used amount */
-    /* Run through all the Buffer header pools and copy */
     for (j = (INTVAL)mem_pools->num_sized - 1; j >= 0; --j) {
         Fixed_Size_Pool * const header_pool = mem_pools->sized_header_pools[j];
         UINTVAL       object_size;
@@ -642,7 +641,8 @@
             skip_blocks[skip_pos++] = cur_block;
         }
         else {
-            total_size += cur_block->size - cur_block->free;
+            //total_size += cur_block->size - cur_block->free;
+            total_size += cur_block->used;
         }
         cur_block   = cur_block->prev;
     }
@@ -731,7 +731,7 @@
 
             if (PObj_is_COWable_TEST(old_buf)) {
                 INTVAL * const new_ref_count = ((INTVAL*) new_pool_ptr) - 1;
-                *new_ref_count        = 2;
+                *new_ref_count        = 0;
             }
 
             /* Copy our memory to the new pool */
@@ -804,7 +804,7 @@
                 if (top_block->start <= (char*)Buffer_bufstart(buf)
                     && (char*)Buffer_bufstart(buf) < top_block->top) {
                     /* ... and update usage */
-                    top_block->used += Buffer_buflen(buf);
+                    top_block->used += aligned_string_size(Buffer_buflen(buf));
                     break;
                 }
 


More information about the parrot-commits mailing list