Hi
I am having a memory leak problem and it is actually generating from the following structure array:
TagStruct TagData [] =
{
{ Tag_SecurityToken, string("x-abc-security-token"), string("ab-security-token") } ,
{ Tag_XYZ, string("x-abc-xyz"), string("ab-xyz") },
{ Tag_ChunkCount, string("x-abc-meta-chunk"), string("ab-meta-chunk") },
{ Tag_OriginalFileSize, string("x-abc-meta-totalsize"), string("ab-meta-totalsize")}
};
the weird thing is of course the memory leak issue and the weirdest issue is that when I close the client *VS dumps the first, third and fourth elements but not the 2nd element (Tag_XYZ).* The memory leak seems to generate on the first run before I even call the array, and bare in mind that I only use the array for checking purposes:
string Get_Tag (Tags tag)
{
return m_ClientType == CType_ABC ? TagData[tag].strABC : TagData[tag].strAB;
}
Thats actually the whole reason for it. So there is no inline heap/memory allocation of any kind.
also the Tag structure looks sth like this:
struct TagStruct
{
Tags tag;
std::string strABC;
std::string strAB;
};
I would also like to let you know that this is a global array and I have also tried to make it static but kept getting Memory leak, also I've tried declaring the strings in the array as "str"
rather than string("str")
but kept getting memory leaks. Yes the memory leak is static, meaning that it does not build over time but still its better to keep a clean code. Any suggestions??