I have following peace of code, when i check it with valgrind it gives me "537 bytes in 19 blocks are possibly lost in loss record 12 of 12"
Following is the code:
CManager.h
class CManager
enum RespType_en
{
eInvalidRes = 0,
eAuthRes,
eActivateRes,
eSetStateRes
}
map<RespType_en, string> m_mRespTags;
in CManager.cpp
CManager::CManager()
{
GenerateResponseTagMap();
}
bool CManager::GenerateResponseTagMap()
{
m_mRespTags[eInvalidRes] = "InvalidRes";
m_mRespTags[eAuthRes] = "AuthRes";
m_mRespTags[eActivateRes] = "ActivateRes";
m_mRespTags[eSetStateRes] = "SetStateRes";
return true;
}
and the valgrind reports :
==3152== 537 bytes in 19 blocks are possibly lost in loss record 12 of 12
==3152== at 0x4020B65: operator new(unsigned) (vg_replace_malloc.c:163)
==3152== by 0x453DB0A: std::string::_Rep::_S_create(unsigned, unsigned, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.8)
==3152== by 0x453F837: std::string::_M_mutate(unsigned, unsigned, unsigned) (in /usr/lib/libstdc++.so.6.0.8)
==3152== by 0x453F9D9: std::string::_M_replace_safe(unsigned, unsigned, char const*, unsigned) (in /usr/lib/libstdc++.so.6.0.8)
==3152== by 0x453FA74: std::string::assign(char const*, unsigned) (in /usr/lib/libstdc++.so.6.0.8)
==3152== by 0x453FBF4: std::string::operator=(char const*) (in /usr/lib/libstdc++.so.6.0.8)
==3152== by 0x8099A73: CManager::GenerateResponseTagMap() (in /test/bin/Service)
==3152== by 0x8099E26: CManager::CManager() (in /test/bin/Service)
==3152== by 0x8099EE1: CManager::Instance(bool) (in /test/bin/Service)
==3152== by 0x8069E27: main (in /test/bin/Service)
So is there any memory leak in
bool CManager::GenerateResponseTagMap() ??