Sunday, February 20, 2011

Garbage has been collected

I've managed to successfully run a garbage collection cycle without causing a crash:

def testCollect {
  // Allocate a string that's not a constant.
  var sampleString = String.format("a{0}", "b");
  // Force a collection
  tart.gc.GC.collect();
  // Ensure that the string is still valid.
  assertEq("ab", sampleString);
}

Woot.

No comments:

Post a Comment