Guest User

Untitled

a guest
Jun 29th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. proc `$`*(key: PublicKey): string =
  2. result = ""
  3. for i in 0 ..< 64:
  4. echo i
  5. result = result & key.data[i].toHex()
  6.  
  7. I have that Nim code to iterate through an array and get the Hex representation of the data inside a PublicKey object. Everytime my program runs, which generates 100 keys for use in a for loop, runs, the 5th time I use it, when i is 11, I get a segfault. The traceback is:
  8.  
  9. PublicKey.nim(20) $
  10. gc.nim(475) newObj
  11. alloc.nim(759) rawAlloc
  12.  
  13. I do manually allocate the memory for the PublicKey object using alloc0, but I do check if it's nil, and it's not. I only dealloc it in one place, at the end of the for loop, after I'm done with all of it. No other place uses realloc or dealloc. Any ideas?
Advertisement
Add Comment
Please, Sign In to add comment