I realize that this is slightly out of scope, but I'm at a loss and would really appreciate some pointers on where to look next.
I'm getting sporadic segmentation faults calling MagickGetImageBlob on the same wand intermittently over time.
The lifecycle of the wand is basically:
1) wand = NewMagickWand()
2) MagickReadImage(wand, "/Users/roxton/image.tif")
3) MagickSetImageFormat(wand, "PNG")
4) image = MagickGetImageBlob(wand, &length)
5) MagickRelinquishMemory(image)
6) Repeat 3-5 at various intervals from different threads, never simultaneously.
7) Eventually segfault on step #4.
Here's the wrinkle. I'm doing this from Java using SWIG. The "OK, doctor, but how would you diagnose this problem if I /weren't/ obese" ethos applies, but I certainly wouldn't snub a SWIG/JNI-oriented suggestion.
The typical error message, FWIW, is:
Invalid memory access of location 0x20 rip=0x11755b550
ImageMagick 6.7.1-0 2011-07-24 Q16
MagickGetImageBlob Issue
Re: MagickGetImageBlob Issue
Recompiling with OpenMP disabled fixed the issue. The question is, though, is the problem due to an issue within ImageMagick or do I need to do something to make JNI play nice with a library compiled with OpenMP? I wouldn't have thought the latter would be necessary, as my JNI wrapper library doesn't use OpenMP directly.
Last edited by roxton on 2011-07-28T14:42:35-07:00, edited 1 time in total.
Re: MagickGetImageBlob Issue
Sometimes OpenMP does not play nicely with other threading libraries. OpenMP and pthreads works properly under Linux but fails under Mac OS X for example. Perhaps that is the source of the problem you reported.