Thanks to Jon for pointing this out to me, we’re pretty sure that the reason perl chokes and gives you a bus error (on OSX) when you run PHFOS [script] like this:
./phfos.pl -d <dir> -r -v --min=2 --max=3 -n 1000
We’re actually guessing that after allocating too many threads, since we aren’t immediately exiting the thread after reading (what –readstop does), we allocate past the amount of stack space perl allocated us, giving us the EXC_BAD_ACCESS (0x0001) error.
Well, how do we fix that? Turns out perl has an option to set individual stack sizes per thread, so if you decrease the size of the stack per thread, we could allocate more threads. Only 1 problem, on OSX
perl -e'use threads; print(threads->get_stack_size(), "\n")'
Gives you:
Can't locate auto/threads/get_stack_s.al in @INC (@INC contains: /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at -e line 1
Anyone else can read about setting stack sizes for perl scripts here (look for the THREAD STACK SIZE section)
Now I need to somehow figure out how I’m going to set thread stack size without being able to see what the values are…
Suggestions?