Arno Garrels wrote: > Fastream Technologies wrote: >> FYI, this is the code: >> >> RAMFileCacheIndex->OnList = CacheTreeOnListForRAM; >> RAMFileCacheIndex->ListTree(); >> >> for(int i = RAMFileCacheIndexList->Count - 1; i >= 0; --i) >> >> deleteFileFromRAMCacheWRTIndex((RAMFileCache*)RAMFileCacheIndexList->Items[i], >> false); (basically deletes the data >> >> RAMFileCacheIndexList->Clear(); >> ... >> >> void __fastcall ProxyCache::CacheTreeOnListForRAM(TObject *Sender, >> const >> String Key, TDateTime TimeStamp, Pointer Data, int Len, TDateTime >> Expires, >> bool &Cancel) >> { >> RAMFileCacheIndexList->Add(Data); >> } >> //--------------------------------------------------------------------------- > > If you do not override DoListNode you have to use a TStringList in > CacheTreeOnListForRAM and add the key. > After ListTree() call RemoveKey() on each list item, and of course > you should have OnFreeData assigned and free your Data there, be it > objects or other pointers to allocated memory.
And if you choose to free Data explicitly somewhere else you should set Data to NULL/nil because otherwise you might attempt to free it a second time from OnFreeData, if Data is NULL OnFreeData won't be triggered for a node. -- Arno Garrels > > -- > Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be