Closed jrraymond closed 6 years ago
I'm suspicious of toList
. It "lazily" returns elements. Look at this:
http://hackage.haskell.org/package/judy-0.3.0/docs/src/Data-Judy.html#toList'
That's asking for a segfault.
(freeze
appears to be the culprit here, which is implemented in terms of toList'
.)
As suspected, toList'
is the reason for the segfault. PR to remove the laziness: https://github.com/mwotton/judy/pull/6/files
The program repeatedly creates two Judy arrays of a given size and performs the union of them. The program will seg-fault.
Unioning two Judy arrays of size 10 never segfaults, but as the size goes up past 100, it almost always seg-faults.
I ran valgrind and there are many read after free'd errors. I think maybe is not a problem with Judy itself but maybe the GHC runtime is cleaning up the judy arrays earlier than it should.