How to fix memory access error
I am working on a migration project, here we are migrating a large set of C ++ libraries from Mainframe to Solaris. We have successfully migrated, but during application launch some locations are reset with a SEGV signal (no display on the error address).
Since the application also supports windows, we tested with cleanup on windows. There are no memory leaks in the application and it works fine on windows.
Can anyone suggest what other reasons might be that could create this type of error. Any tools to track down this type of error?
This is not necessarily a memory leak. Maybe a chunk of memory is referenced after it is free.
A friend of mine once came to me with a piece of code that works fine on Windows, but gives segv on Linux. It turned out that sometimes the memory stays valid after you freed it on Windows (maybe for a short period of time), but immediately called segv on Linux.
source to share
I am using the CC compiler on Solaris and the dbx debugger. I know the call stack where it falls. But this is a crash.
map<string,CDBBindParam,less<string> >m_BindMap;
CNumString ns(CNumStringTraits(0,2,'0'));
ns = m_BindMap.size();
string sLabel = ":BIND"+ns;
CDBBindParam b(sLabel,val);
**m_BindMap[sLabel] = b;** // crashes at this line at when map size is more than 2
return sLabel;