Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

OpenMP leak @ DLL

Yaroslav_Korchevsky
745 Views
This issue has been derived from this thread:
http://redfort-software.intel.com/en-us/forums/showthread.php?t=107048&o=a&s=lr
Here is the project, which demonstrates the leak
IntelOMP-leak.zip

I got OMP library from Composer XE with IPP.

call of omp_get_num_procs() inside of DLL allocates ~2 .3 MB, and doesn't release it at FreeLibrary(...).

Is there any solution of this leak prevention?
0 Kudos
1 Solution
SergeyKostrov
Valued Contributor II
745 Views
This issue has been derived from this thread:
http://redfort-software.intel.com/en-us/forums/showthread.php?t=107048&o=a&s=lr
Here is the project, which demonstrates the leak
IntelOMP-leak.zip

I got OMP library from Composer XE with IPP.

call of omp_get_num_procs() inside of DLL allocates ~2 .3 MB, and doesn't release it at FreeLibrary(...).

Is there any solution of this leak prevention?

     [SergeyK] No ( please correct me if I'm wrong... ), because a root source of the problem is not clear.


Hi Yaroslav,

Why did you decide that Intel OpenMP library is "responsible" for these memory leaks?

'Module+omp.dll' depends on:

     libiomp5ui.dll
     libittnotify.dll                  // ITT stands for Intel Threading Tools

and

     static library libiomp5mt.lib

and

     tbbmalloc.dll                  // It is used somehow...

The final error message:

     The memory manager cannot access sufficient memory to initialize; exiting

comes from 'tbbmalloc.dll' ( take a look at 'initMemoryManager' function in 'frontend.cpp' ) and
this is a known problem on the TBB forum:

     'The memory manager cannot access sufficient memory to initialize; exiting'
     http://redfort-software.intel.com/en-us/forums/showthread.php?t=106904&o=a&s=lr

Best regards,
Sergey

PS: There is a possibility that it could also be related to another problem in 'tbbmalloc.dll':

     'Resource Leaks in TbbMalloc DLLs: A destructor TLSKey::~TLSKey is not called'
     http://redfort-software.intel.com/en-us/forums/showthread.php?t=107231&o=a&s=lr

View solution in original post

0 Kudos
9 Replies
Vladimir_P_1234567890
745 Views
Hello Yaroslav,
what is copmpiler version? there are a few leaks fixed and the latest compiler 12.1 updates.
thanks,
Vladimir 
0 Kudos
Yaroslav_Korchevsky
745 Views
I got this library not with compiler.
I have IPP 7.0.7 in Composer XE 2011 SP1.325 environment.
As I imagine, Composer XE 2011 SP1.325 is part of IPP product since IPP-7.x.x
This environment has compiler subdirectory.
0 Kudos
jimdempseyatthecove
Honored Contributor III
745 Views
>>call of omp_get_num_procs() inside of DLL allocates ~2 .3 MB, and doesn't release it at FreeLibrary(...)

On each call?
    program start
    load library
    omp_get_num_procs()
    FreeLibrary
    load library
    omp_get_num_procs()
    FreeLibrary
    End program

Is an OpenMP thread team established within your program prior to load of your library?
If not, then what happes if you establish an OpenMP thread team prior to first library load?
And if not, does the OpenMP thread team (established by the library) persist after the first load, omp_get_num_procs(), FreeLibrary?

Jim Dempsey
0 Kudos
Yaroslav_Korchevsky
745 Views
Jim,

In my program there is no explicit OpenMP thread team establishment.
Looks like the implicit establisment doesn't happen as well.
I'm not aware how to assert OpenMP thread team establishment happen.
Can you give me some hints?

0 Kudos
SergeyKostrov
Valued Contributor II
746 Views
This issue has been derived from this thread:
http://redfort-software.intel.com/en-us/forums/showthread.php?t=107048&o=a&s=lr
Here is the project, which demonstrates the leak
IntelOMP-leak.zip

I got OMP library from Composer XE with IPP.

call of omp_get_num_procs() inside of DLL allocates ~2 .3 MB, and doesn't release it at FreeLibrary(...).

Is there any solution of this leak prevention?

     [SergeyK] No ( please correct me if I'm wrong... ), because a root source of the problem is not clear.


Hi Yaroslav,

Why did you decide that Intel OpenMP library is "responsible" for these memory leaks?

'Module+omp.dll' depends on:

     libiomp5ui.dll
     libittnotify.dll                  // ITT stands for Intel Threading Tools

and

     static library libiomp5mt.lib

and

     tbbmalloc.dll                  // It is used somehow...

The final error message:

     The memory manager cannot access sufficient memory to initialize; exiting

comes from 'tbbmalloc.dll' ( take a look at 'initMemoryManager' function in 'frontend.cpp' ) and
this is a known problem on the TBB forum:

     'The memory manager cannot access sufficient memory to initialize; exiting'
     http://redfort-software.intel.com/en-us/forums/showthread.php?t=106904&o=a&s=lr

Best regards,
Sergey

PS: There is a possibility that it could also be related to another problem in 'tbbmalloc.dll':

     'Resource Leaks in TbbMalloc DLLs: A destructor TLSKey::~TLSKey is not called'
     http://redfort-software.intel.com/en-us/forums/showthread.php?t=107231&o=a&s=lr

0 Kudos
SergeyKostrov
Valued Contributor II
745 Views

Here is a 'TestLog.zip' for your review. Take a look at last a couple of records:

     ...
    DLL has been unload Mem= private mem: 2089128K, working set: 179748K, peak working set: 179976K, page file usage: 2089128K
    Before Load DLL     Mem= private mem: 2089128K, working set: 179748K, peak working set: 179976K, page file usage: 2089128K
    DLL has been load   Mem= private mem: 2089196K, working set: 179788K, peak working set: 179976K, page file usage: 2089196K
    The memory manager cannot access sufficient memory to initialize; exiting
    ...

A last value for the 'Page File Usage' is 2089196KB and this is 1.992GB of memory. The test application exited
in 'initMemoryManager' function of 'tbbmalloc.dll' because 'VirtualAlloc' Win32 API function couldn't allocate
a new 64KB memory block. In another words, a 2GB limit on a 32-bit Windows platform was reached.

Best regards,
Sergey

0 Kudos
SergeyKostrov
Valued Contributor II
745 Views
Jim,

In my program
there is no explicit OpenMP thread team establishment.
Looks like the implicit establisment doesn't happen as well.
I'm not aware how to assert OpenMP thread team establishment happen.
Can you give me some hints?


Yaroslav's test-case is a perfect reproducer ( Thank you ) and I recommend to look at it and run it.

Best regards,
Sergey

0 Kudos
Yaroslav_Korchevsky
745 Views
Thank you, I will dig there.
0 Kudos
Andrey_C_Intel1
Employee
745 Views
Yaroslav,

I checked your test and indeed the OpenMP library you are using contains memory leaks. This problem had been fixed in the next release of the compiler. So I'd suggest you update the compiler to newer version, e.g. version 12.1.5.344 released in June 2012.

Regards,
Andrey
0 Kudos
Reply