okFrontPanel library causes Matlab to crash sometimes

We are running a rather extensive code in Matlab in which the program communicates with the FPGA board.
The code loads the okFrontPanel dll library at the startup. However sometimes when we run the code it causes Matlab to crash at the startup. The crashes are occasional and do not happen always.
If we wait sometime after opening Matlab and then run the code, then usually we do not see any crash.
We think the loading of the okFrontPanel library is the reason for occasional Matlab crashes because of overloading the memory.

Did anyone experience the same problem? Is there any way to avoid these occasional crashes?
l thought of putting a pause command at the beginning of my Matlab code to wait some time and then run the code but it did not prevent the crashes.

Thank You

Are you interacting with the DLL at all before you see the crash? Have you tried only loading the DLL?

The FrontPanel DLL doesn’t allocate any large buffers, so it should not be the cause of a memory issue.

Have you reached out to Mathworks to try to get some insight?

Hello and thanks for your response.
Yes , we are certain that the crash occurs, when the okFrontPanel library is being called. The following line is causing the crash:
calllib(‘okFrontPanel’, ‘okFrontPanel_GetWireInValue’, xptr, hex2dec(‘1F’), buf_mode);