Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Multimple IppInit() and memory leak with _IPP_PARALLEL_STATIC at ippcore_t

Yaroslav_Korchevsky
3,434 次查看
I use statically linked IPP in mulithreading application which consists of many modules.
Modules may be loaded and unloaded.
Each IPP linked module require IPP to be initialized.
However, as it is known, IppInit() is required to be called once per process.
Multiple calls to IppInit() produces memory leaks.

Use IppInit() in main module is not allowed by design.
So, each module at load time needs to decide is IppInit() required or not.
I didn't find any way to make my application call IppInit() only once per process.

Does anybody know is there any method to find is IPP initialized already or not?

PS. Environment: VisualStudio C++ 2008
0 项奖励
1 解答
Sergey_K_Intel
3,433 次查看
Yaroslav,
I see _kmp_str_format call wher you have pointed at. It allocates about 3K bytes for setting environment variable. But, after FreeLibrary the allocated memory gets back to operating system.
The problem is not in that kmp_str_format allocates something. The question is why this memory is not returned back after FreeLibrary call?
Could you ask this on Intel compiler forum?
By the way, you can prepare the test sample without IPP, only with OpenMP. Create a empty DLL linked to libiomp5 (i.e. Intel's OpenMP). Call omp_get_num_procs, then unload your custom DLL. Will the behavour be the same?
Regards,
Sergey

在原帖中查看解决方案

0 项奖励
26 回复数
Yaroslav_Korchevsky
539 次查看
Sergey.
Is there any progress?
0 项奖励
Yaroslav_Korchevsky
539 次查看
To whom this issue may be addressed if not you?
0 项奖励
SergeyKostrov
重要分销商 II
539 次查看
Hi Yaroslav,

Quoting Yaroslav Korchevsky
Sergey.
Is there any progress?


I'm sorry - No. However, I'll take a look at the recent thread posts.

Best regards,
Sergey

0 项奖励
Chao_Y_Intel
主持人
539 次查看

Hello Yaroslav,

I see Sergey provided some suggestion on the replay on #20:

This problem looks related to the OpenMP libraries. The OpenMP library comes from Intel Compiler, and Intel IPP use this library for function threading. That is why he suggested checking this problem on the Intel compiler forum:

To show this problem clearly, he also suggest following the following test case:

You can prepare the test sample without IPP, only with OpenMP. Create a empty DLL linked to libiomp5 (i.e. Intel's OpenMP). Call omp_get_num_procs, then unload your custom DLL. Will the behavour be the same

That will help to isolated if the root problem come from OpenMP.

Thanks,
Chao

0 项奖励
Yaroslav_Korchevsky
539 次查看
Thank you, Chao,

I prepared purified example with OpenMP only.
My question was about where to post it.


0 项奖励
Chao_Y_Intel
主持人
539 次查看

Hello Yaroslav,

Here is the forum for the compiler:
http://software.intel.com/en-us/forums/intel-c-compiler/

Thanks,
Chao

0 项奖励
回复