Closed nehaljwani closed 3 years ago
Thanks for the PR. The implementation of uniq
is tail-recursive, so the reason for the crash is the fact that I messed the compilation flags recently and accidentally left them at -O0
level.
Thank you for reminding me about that concept!
As the number of unique files accessed grow in number, the recursive implementation of
uniq()
can lead to a segfault because of stack size limitations. One can work around this by increasing the stack size limit(ulimit -s)
, however that is not always possible.This commit changes the implementation of
uniq()
to use iteration so that such limits do not lead to problems.