tunsafenew2.nim 229 B

12345678910111213141516
  1. discard """
  2. valgrind: "leaks"
  3. matrix: "-d:useMalloc"
  4. targets: "c cpp"
  5. """
  6. type
  7. Obj = object
  8. case b: bool
  9. else: discard
  10. a: UncheckedArray[byte]
  11. var o: ref Obj
  12. unsafeNew(o, sizeof(Obj) + 512)
  13. zeroMem(addr o.a, 512)