Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
6 Views

LoaderLock managed exception when using ipps API within a c++/cli dll

Hi,

We have just ported to IPP 6.1, and had to update the deprecated ippiResize to ippiResizeSqrPixel.
However, when we added the code to allocate the buffer (ippsMalloc, ippsFree), at runtime debug we get the LoaderLock exception warning that: "Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang."
It's worth mentioning that before this update our code did not use or link ipps library.

I imagine this is related to the managed class that calls our c++/cli class which uses the ipps functions. But I fail to understand why initializing ipps cause this issue.

- I did not find any documentation of this issue.
- Calling ippi, ippcv, ... libraries has no issues with managed/unmanaged communication.

Please advise on this issue.

Thanks, Hagay Lupesko.
0 Kudos
1 Reply
Highlighted
Employee
6 Views

The ippsMalloc/ippsFree only call system malloc/free funtions, and pad the memory to 32 byte alignment. As a wordaround, can the following code work for you? It just call system malloc function, and make the memory address alinged to 32 bytes.

Thanks,
Chao

int datasize;
void * pBuffer,*pAlignedBuffer;

pBuffer=malloc (datasize + 31);
pAlignedBuffer = (void *)(((int)pBuffer+31)&(~31));

// pAlignedBuffer is 32 byte aligned.
// free(pBuffer);

0 Kudos