trace_globals.nim 781 B

1234567891011121314151617181920212223242526272829303132333435
  1. discard """
  2. output: '''
  3. 10000000
  4. 10000000
  5. 10000000'''
  6. retries: 2
  7. """
  8. # bug #17085
  9. #[
  10. refs https://github.com/nim-lang/Nim/issues/17085#issuecomment-786466595
  11. with --gc:boehm, this warning sometimes gets generated:
  12. Warning: Repeated allocation of very large block (appr. size 14880768):
  13. May lead to memory leak and poor performance.
  14. nim CI now runs this test with `testWithoutBoehm` to avoid running it with --gc:boehm.
  15. ]#
  16. proc init(): string =
  17. for a in 0..<10000000:
  18. result.add 'c'
  19. proc f() =
  20. var a {.global.} = init()
  21. var b {.global.} = init()
  22. var c {.global.} = init()
  23. echo a.len
  24. # `echo` intentional according to
  25. # https://github.com/nim-lang/Nim/pull/17469/files/0c9e94cb6b9ebca9da7cb19a063fba7aa409748e#r600016573
  26. echo b.len
  27. echo c.len
  28. f()