tfragment_gc.nim 745 B

1234567891011121314151617181920212223242526272829303132
  1. discard """
  2. output: '''occupied ok: true
  3. total ok: true'''
  4. disabled: "true"
  5. """
  6. import strutils, data
  7. proc main =
  8. var m = 0
  9. # Since the GC test is slower than the alloc test, we only iterate 100_000 times here:
  10. for i in 0..100_000:
  11. let size = sizes[i mod sizes.len]
  12. let p = newString(size)
  13. # c_fprintf(stdout, "iteration: %ld size: %ld\n", i, size)
  14. main()
  15. let occ = getOccupiedMem()
  16. let total = getTotalMem()
  17. # Concrete values on Win64: 58.152MiB / 188.285MiB
  18. let occupiedOk = occ < 82 * 1024 * 1024
  19. if not occupiedOk:
  20. echo "occupied ", formatSize(occ)
  21. echo "occupied ok: ", occupiedOk
  22. let totalOk = total < 230 * 1024 * 1024
  23. if not totalOk:
  24. echo "total peak memory ", formatSize(total)
  25. echo "total ok: ", totalOk