Joel Pilon(deleted)
|
RE: malloc failure for std::string
|
Joel Pilon(deleted)
01/07/2015 12:48 PM
post112859
|
RE: malloc failure for std::string
It's likely heap corruption, you could inspect you code's use of pointers and ensure nothing is witting out of bounds or
writing to a freed memory.
If it's not reproducible with debug, you can try more light weight instrumentation, perhaps creating malloc/free/calloc
wrapper.
-Joel
________________________________________
From: atish bhowmick [community-noreply@qnx.com]
Sent: Wednesday, January 07, 2015 12:27 PM
To: technology-networking
Subject: malloc failure for std::string
I am getting a random crash with the following error :
Malloc Check Failed: :/builds/660_SDP/svn/lib/c/alloc/band.c:492
I am using Momentics 5.0 & Qnx 6.6 .
from the core dump (given below ) I can see that malloc is failing is for std::string objects & operations which I am using in my code . I have run the exe in debug mode with memory analysis tooladded from Momentics IDE. I also enabled all the memory error check options in memory analysis tool tab. But in all these debug runs no crash occurs in the scenario .Also the memory analysis view doesnt show any memory problems with the exe after several runs.
However when i execute the same code in non debug mode or debug mode without memory analysis tool , I get the same memory allocation crash . It occurs randomly at different places in the code where I am doing std::string operations for which memory allocations are required . Below is a call stack :
SignalKill() at 0xb034cf5d
raise() at 0xb0336348
__malloc_panic_str() at 0xb033020a
__malloc_panic() at 0xb03302ed
_band_get_aligned() at 0xb032ea19
_band_get() at 0xb032ebeb
__malloc_lock.constprop.2() at 0xb0332c00
malloc() at 0xb033289b
operator new() at 0xb825f7ca
std::_Allocate<char>() at xmemory0:18 0x8052df4
std::allocator<char>::allocate() at xmemory0:741 0x8052ca9
std::_Wrap_alloc<std::allocator<char> >::allocate() at xmemory0:1,067 0x80529ae
std::string::_Copy() at xstring:2,310 0x8051dde
std::string::_Grow() at xstring:2,341 0x80515a1
std::string::append() at xstring:1,171 0x8050de7
std::string::append() at xstring:1,182 0x805013b
std::string::operator+=() at xstring:1,124 0x8060d16
QNXCommonUtils::readLineBuffered() at QNXCommonUtils.cpp:158 0x806ab4d
SystemConfig::readIniFileInMem() at SystemConfig.cpp:461 0x80562cb
SystemConfig::mergeNVPData() at SystemConfig.cpp:2,176 0x805d86e
SystemConfig::updateIniFile() at SystemConfig.cpp:938 0x8057e73
SystemConfig::UpdateAllIni() at SystemConfig.cpp:866 0x8057b6e
CQNXUpgradeManager::processIPSPolicyUpdate() at CQNXUpgradeManager.cpp:501 0x807ae6f
CQNXUpgradeManager::applyThePackage() at CQNXUpgradeManager.cpp:896 0x807cc73
CQNXUpgradeManager::run() at CQNXUpgradeManager.cpp:1,377 0x807f258
Thread<CQNXUpgradeManager>::ThreadFunc() at Thread.h:59 0x8051330
Any pointers wud be very helpful to find the root cause of malloc failure .
_______________________________________________
Technology
http://community.qnx.com/sf/go/post112857
To cancel your subscription to this discussion, please e-mail technology-networking-unsubscribe@community.qnx.com
|
|
|