// activity: runnable/voidfunc()/func() -> O // function result will be held during measurement static long measureTotalObjectSize(O activity, S desc) { long mem1 = memoryUsedAfterGC(); O result = callF(activity); long mem2 = memoryUsedAfterGC(); long diff = mem2-mem1; print("Memory used" + (nempty(desc) ? " for " + desc : "") + ": " + toK(diff) + " K"); ret diff; } static long measureTotalObjectSize(O activity) { ret measureTotalObjectSize(activity, shorten(str(activity), 40)); }