Fun fact: mmap returns -1, not 0, on error. STL may therefore not be detecting this as an error and throwing std::badalloc.
Try adding code to allocate that checks for mmap returning -1. Preferably something that calls sterror and prints function arguments before dying. Kenneth On 08/06/2012 02:28 PM, Marcin Junczys-Dowmunt wrote: > Ouch, I hate that file. That's the only code I wrote which I do not > fully understand myself. :) > > Unfortunately I do not have access to an OS X system and cannot try for > myself. This line fills a virtual memory address pointed to by p with > the given value. So basically this is nothing else but a write to a file. > > You only get a segfault, no bad alloc or something? Does the > std::tmpfile function work under OS X and does it create writeable > files? Could also be a pagesize problem. Pure guessing here. > > W dniu 06.08.2012 20:11, Hieu Hoang pisze: >> i ran the identical command and pt on linux and it fine. The problem >> only appears on mac osx. >> >> putting it into a debug, it seems to blow up in >> MmapAllocator.h line 158 >> >> On 06/08/2012 18:00, Marcin Junczys-Dowmunt wrote: >>> Just checked that toy phrase-table with your command, works fine for me. >>> >>>> 3. I tried compacting a 22 line phrase table (attached) and got a >>>> segfault. The command I ran was >>>> ~/workspace/github/moses-smt/bin/processPhraseTableMin -in >>>> phrase-table -out compact/phrase-table -nscores 1 -threads 2 >>>> I'll try& debug it myself but if you can see an obvious problem, >>>> please let me know >>> _______________________________________________ >>> Moses-support mailing list >>> [email protected] >>> http://mailman.mit.edu/mailman/listinfo/moses-support >>> >> >> _______________________________________________ >> Moses-support mailing list >> [email protected] >> http://mailman.mit.edu/mailman/listinfo/moses-support >> > > _______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
