I was trying to create a simple linked list. But I saw crashes as soon as I 
added more than a few hundred thousand nodes. I then tried the lists module 
from the standard library but saw the same behavior.

Why does the following result in a segfault? Am I doing something wrong?
    
    
    import lists, os
    
    var a = initSinglyLinkedList[int]()
    
    for i in 1..1_000_000:
      a.add(i)
    
    echo "added"
    
    sleep(5000)
    
    echo "continue"
    
    
    Run

The segfault happens after the sleep, so I'm guessing this has something to do 
with garbage collection.

Reply via email to