Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

fftw2xc crashes on second use

I'm calling the compiled fftw2xc_ms.lib(x64) in a MFC dll (x64) that I linked it to. I call the fft functions thousands of times to align a sequence of images and when they're aligned I unload the dll. This dll is called from a MATLAB (r2010a)program. The sequence of images aligns correctly, or least the result is the same as using the genuine fftw library functions. While running the same Matlab session I call the dll again to load the same sequence and as soon as the dll gets to the fftw function calls it crashes immediately. This is the same exact data called in the same exact way. Matlab catches the error before it crashes and here is what is says:


Segmentation violation detected at Wed Dec 01 12:37:16 2010



MATLAB Version: (R2010a)

MATLAB License: 505265

Operating System: Microsoft Windows 7

Window System: Version 6.1 (Build 7600)

Processor ID: x86 Family 6 Model 10 Stepping 5, GenuineIntel

Virtual Machine: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot 64-Bit Server VM mixed mode

Default Encoding: windows-1252

Fault Count: 1

Register State:

rax = 00000000663fe0e8 rbx = 00000000348f71c0

rcx = 0000000000000001 rdx = 0000000000000000

rbp = 0000000000000800 rsi = 0000000000000001

rdi = 0000000000000001 rsp = 00000000010246f8

r8 = 0000000000000000 r9 = 0000000033fb1e60

r10 = 0000000000000000 r11 = 3ff0000000000000

r12 = 000000003417d4d0 r13 = 0000000043b3af10

r14 = 0000000043e7aa10 r15 = 0000000043e7aa50

rip = 0000000047da1740 flg = 0000000000010246

Stack Trace:

[ 0] 00000000658EC720 mkl_mc3.dll+9815840 (mkl_dft_dfti_create_drmd+003504)

[ 1] 00000000078CD8B9 aqaln01.dll+055481 (FrameAlignment+014265)

If this problem is reproducible, please submit a Service Request via:

A technical support engineer might contact you with further information.

Thank you for your help. MATLAB may attempt to recover, but even if recovery appears successful,

we recommend that you save your workspace and restart MATLAB as soon as possible.

So it looks like a pointer has gone awry, but I can't debug it. The error is reproduceable, as every time I try to call the dll from a Matlab session twice I get the same exact error message (well, thememory states are not identica)l, even regardless of the dimensions of the image that I align. These two parts of the lines are alwaysthe same:

mkl_mc3.dll+9815840 (mkl_dft_dfti_create_drmd+003504)

aqaln01.dll+055481 (FrameAlignment+014265)

I can't get into the code to see what the create_drmd function does, but I suppose it has something to do with creating a plan. The mkl_mc3.dll is the mkl core for i7 processors. Does anyone have any tips for debugging this?


0 Kudos
2 Replies
Hi Sean,

Could you please provide additional information: what MKL version do you use, and the link line for aqaln01.dll?

For debugging ideas,you could try if the problem reproduces if you set environment variableMKL_DISABLE_FAST_MM=1. This turns of MKL memory manager that uses internal buffers that maysurvive dll unload and interfere withthe second load.Some details onMKL memory manager can be found in MKL User's Guide. If this happens to solve the issue, you may need to add processing of DLL_PROCESS_DETACH in aqaln01.dll to free MKL buffers with a call to MKL_Free_Buffers. I am not sure this is relevant to the issue you see, just an idea.

I would also recommend you to submit the issue at

The link line is: mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib
and the MKL version is

I tried setting the environment variable, which I did through the "System Properties" part of the control panel and also tried a call to MKL_Free_Buffers, but neither worked. I'll have to submit this to as you suggested.