Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
Intel Customer Support will be observing the Martin Luther King holiday on Monday, Jan. 17, and will return on Tues. Jan. 18.
For the latest information on Intel’s response to the Log4j/Log4Shell vulnerability, please see Intel-SA-00646

How can I debug bad alloc exception

Riyad_Parvez
Beginner
151 Views

I'm a newbie at Intel TBB. I'm using concurrent_vector and concurrent_hash_map. I haven't allocate anything using new, so may be there is no memory leak. But I'm getting bad allocation exception. I'm using 32 bit Linux Mint 14 on VMWare workstation which has 3GB of memory. How can I debug is my program leaking memory or it's just the program can't allocate enough memory?

0 Kudos
3 Replies
jimdempseyatthecove
Black Belt
151 Views

Does the program load? (IOW can you set a breakpoint at first execuitable statement in main and run to break?)

Jim Dempsey

Riyad_Parvez
Beginner
151 Views

Yes, the program loads. It even run for a while. Then it throws bad_alloc exception

jimdempseyatthecove
Black Belt
151 Views

You may have memory leak, or memory fragmentation, or simply require more memory that what is available. If you have the scalable allocator enabled, try disabling it.

You can also insert heap hook functions to track allocations and frees:

http://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html

Jim Dempsey

Reply