General protection fault?

While testing some new stuff in ArtPaint, I ran into a crash, and the error is “Exception: (General Protection Fault)” - what does this mean in the context of Haiku? Is it the same as a segfault? I’m used to GPFs on Windows but this is the first time I saw one in Haiku. In Jon Yoder’s book it mentions that Windows GPFs were the same as segfaults, but doesn’t say anything about them in Haiku. It’s a weird error that I’m not really familiar with. Looks like in the kernel it’s related to SIGILL? Everything was running fine for a while and then it crashed so I wondered if it was a memory leak or thread race (I did find memory leaks in the code that crashed). I appreciate any tips or thoughts.


Yes, it’s a segmentation fault, the program tried to access memory space it isn’t allowed to.

Would it help in this case to run with: {application-name}

or with heap protection: MALLOC_DEBUG=grs25 {application-name}


1 Like

Ok, thanks. I’ve seen Segment Violations that are clearly bad memory accesses but wasn’t sure in this case. Thanks for confirming!

@humdinger i was thinking of trying to run a debug build although sometimes debug builds are more resilient towards memory issues. But still I’m hoping it was related to the memory leaks I fixed because I painted for a good 30 minutes before it crashed (in the same painting code). Otherwise that could mean a hard-to-find race/thread safety issue.

running it with a debug build, I found the issue - getting 2 pointers back from a function and only checking ONE of them for NULL. :wink:

glad it was me who found the crash instead of a user!