[svn:parrot] r48008 - branches/hash_allocator/src

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Mon Jul 5 10:50:46 UTC 2010


Author: whiteknight
Date: Mon Jul  5 10:50:46 2010
New Revision: 48008
URL: https://trac.parrot.org/parrot/changeset/48008

Log:
[hash] free all the buckets we allocate. This doesn't resolve the segfault I'm seeing

Modified:
   branches/hash_allocator/src/hash.c

Modified: branches/hash_allocator/src/hash.c
==============================================================================
--- branches/hash_allocator/src/hash.c	Mon Jul  5 10:42:15 2010	(r48007)
+++ branches/hash_allocator/src/hash.c	Mon Jul  5 10:50:46 2010	(r48008)
@@ -826,9 +826,6 @@
 
     memset(new_bi, 0, total_size);
 
-    /* update hash data */
-
-
     /* Recalculate the index for each bucket. Some will stay where they are,
        some will move to a new index. */
     for (i = 0; i < old_size; ++i) {
@@ -1011,6 +1008,14 @@
 parrot_hash_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Hash *hash))
 {
     ASSERT_ARGS(parrot_hash_destroy)
+    UINTVAL i;
+    for (i = 0; i <= hash->mask; i++) {
+        HashBucket * b = hash->bucket_indices[i];
+        while (b) {
+            Parrot_gc_free_fixed_size_storage(interp, sizeof(HashBucket), b);
+            b = b->next;
+        }
+    }
     Parrot_gc_free_memory_chunk(interp, hash->bucket_indices);
     Parrot_gc_free_fixed_size_storage(interp, sizeof (Hash), hash);
 }


More information about the parrot-commits mailing list