I have a RAM of 2 GB. We have a application which performs Export/Import operations. We have a recursive function which has one local variable of type Set which keeps on getting populated every iteration. This Set keeps growing and at one point we run out of memory.
Is there any alternative data structure which can optimally use the memory ?
Here's the rough code
GetObjectsForExportImpl(long lExportOptions, __int64 numIdProject, XExportSets
&exportSets, long lClientId, CComPtr<IEPIPDServer> ptrIPDServer,FILE *fp)
{
XExportSets exportLocal; //Thats a structure containing the Set
QueryObjectsForExport(lExportOptions, numIdProject, exportLocal,
lClientId, ptrIPDServer);
SetIDs::iterator it = exportLocal.setShared.begin();
for (; it != exportLocal.setShared.end(); ++it)
{
//recursive call
pExportObject->GetObjectsForExportImpl(lExportOptions,
numIdProject, exportSets, lClientId, ptrIPDServer,fp);
}
}