M
mohitanchlia
I have written a program that loads a file having 3 columns into a
map. Here is the declaration:
struct strE
{
char iEID[22+1];
char acEN[6+1];
int iDed;
};
map<string, struct strE> mEro;
struct strE eStr = {0,};
if ( 0 < vDataColumn.size() )
eStr.iDzReceived =
atol(vDataColumn.at(0).c_str());
//vDataColumn has columns from file which is "|" delimiter separated.
We split the line into columns and store it in vDataColumn
mEro.insert(std:air<std::string,
struct strERO>(key, eStr)
);
I am seeing that for 6MB file the resident memory is around 12 MB. It
looks like either there is a memory leak or limitation in Map. I am
not sure what kind of memory mangement is used by Map. Could somebody
shed some light as what would be the best approach and dos and donts
when dealing with Maps
map. Here is the declaration:
struct strE
{
char iEID[22+1];
char acEN[6+1];
int iDed;
};
map<string, struct strE> mEro;
struct strE eStr = {0,};
if ( 0 < vDataColumn.size() )
eStr.iDzReceived =
atol(vDataColumn.at(0).c_str());
//vDataColumn has columns from file which is "|" delimiter separated.
We split the line into columns and store it in vDataColumn
mEro.insert(std:air<std::string,
struct strERO>(key, eStr)
);
I am seeing that for 6MB file the resident memory is around 12 MB. It
looks like either there is a memory leak or limitation in Map. I am
not sure what kind of memory mangement is used by Map. Could somebody
shed some light as what would be the best approach and dos and donts
when dealing with Maps