Fixes #19. Add destructor to ConditionBank.
[junction.git] / samples / MallocTest / MallocTest.cpp
index a6695d2a8b44905e0c0c015e9c69e7b4fc0d0c0a..3aba8f0c7058fc3d5074ad68fde17ac584a71fa6 100644 (file)
@@ -1,6 +1,6 @@
 /*------------------------------------------------------------------------
   Junction: Concurrent data structures in C++
-  Copyright (c) 2016 Jeff Preshing
+  Copyright (c) 2016-2017 Jeff Preshing
 
   Distributed under the Simplified BSD License.
   Original location: https://github.com/preshing/junction
@@ -22,14 +22,19 @@ int main() {
     junction::extra::MapAdapter::ThreadContext context(adapter, 0);
     junction::extra::MapAdapter::Map map(65536);
 
+    context.registerThread();
+
     ureg population = 0;
     for (ureg i = 0; i < 100; i++) {
 #if TURF_USE_DLMALLOC && TURF_DLMALLOC_FAST_STATS
         std::cout << "Population=" << population << ", inUse=" << TURF_HEAP.getInUseBytes() << std::endl;
 #endif
         for (; population < i * 5000; population++)
-            map.set(population + 1, (void*) ((population << 2) | 3));
+            map.assign(population + 1, (void*) ((population << 2) | 3));
     }
 
+    context.update();
+    context.unregisterThread();
+
     return 0;
 }