LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add-in memory leak

I have an Excel 2003 Add-in, written in VC++ 6.0 using MFC that manages a
cache of information that must be reloaded if it changes. Using the
performance monitor I look at memory available and see that freeing the cache
does not release any memory and reloading the cache consumes memory,
depending on the size of the cache. Am I deleting the cache correctly? Look
at CCache::Clear(), below:

CCache::Load()
{
Clear();

for(/*Get each record from database...*/; /*...*/; /*...*/)
{
CCacheRecord * record = new CCacheRecord(/*...*/);
mapIntToRecord.SetAt(record-i, record);
}
}

CCache::Clear()
{
for(POSITION pos = mapIntToRecord.GetStartPosition(); pos != NULL; )
{
int i;
CCacheRecord * record;
mapIntToRecord.GetNextAssoc(pos, i, record);
delete record;
}
mapIntToRecord.RemoveAll();
}

CMap<int, int, CCacheRecord *, CCacheRecord * mapIntToRecord;

class CCacheRecord
{
public:
CCacheRecord(/*...*/) { /* fill record from database */ }
private:
int i;
CString name;
...
}

Any help or suggestions would be useful.

Thanks,

Curt
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL 2007 - Out of Memory - memory leak/bug? PCLIVE Excel Discussion (Misc queries) 0 March 23rd 09 03:31 PM
Memory Leak Sakkie Excel Programming 4 November 19th 06 09:17 AM
Memory Leak MD Excel Programming 1 May 28th 04 05:14 PM
Memory Leak GSS[_2_] Excel Programming 1 December 22nd 03 09:21 PM
Memory Leak using ADO 2.6 Jason[_17_] Excel Programming 2 August 26th 03 02:42 PM


All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"