cmodule2 TestManagedStringList > DynTestModule { class Test { PersistentManagedObjects_v1 pm = new(ManagedStringList.factory()); ManagedStringList l = new(pm.mem); ListTester tester; int garbageCollectAtLeastEvery = 10; run { pm.setUserData(l); tester = new ListTester(l, lambda1 rotate); tester.rotateAtLeastEvery = 3; tester.run(); } LS rotate(LS _l) { print("Rotating. memSize=" + pm.mem.size() + ", free=" + pm.mem.freeList.totalFree); //print("Free list: " + pm.mem.freeList.lengthStats()); print("Free list: " + pm.mem.freeList.asList()); pm.mem.freeList.sanityTest(); l.flush(); pm.setUserData(l); pm.flush(); bool gc = oneIn(tester.random, garbageCollectAtLeastEvery); if (gc) { print("GC!"); pm.collectAndCompact(); print("New mem size: " + pm.mem.size()); } S hex = print(intArrayToHex(takeFirst(40, pm.mem.mem))); pm = pm.rotate(); if (!gc) { S hex2 = print(intArrayToHex(takeFirst(40, pm.mem.mem))); assertEquals(hex, hex2); } ret l = pm.getUserData(); } } void test { new Test().run(); } }