tgc.nim 350 B

1234567891011121314151617181920
  1. discard """
  2. target: "c"
  3. """
  4. import coro
  5. var maxOccupiedMemory = 0
  6. proc testGC() =
  7. var numbers = newSeq[int](100)
  8. maxOccupiedMemory = max(maxOccupiedMemory, getOccupiedMem())
  9. suspend(0)
  10. start(testGC)
  11. start(testGC)
  12. run()
  13. GC_fullCollect()
  14. doAssert(getOccupiedMem() < maxOccupiedMemory, "GC did not free any memory allocated in coroutines")