Thanks Walter I'm going to hunt for the memory leak now. Unfortunately I can't use memcheck because I can't compile with TD32 debug info - I get a "[Fatal Error] Internal error: DBG1477" - I've googled this and not found anything useful.
I like your suggestion for a better TObjectList - and particularly your kind offer of help! I might take a stab at this today too and call for the cavalry if I come unstuck... Cheers Dave Walter Prins wrote: >----- Original Message ----- >From: "Dave Sellers" <[EMAIL PROTECTED]> >To: <[email protected]> >Sent: Friday, June 03, 2005 3:00 PM >Subject: [list] Re: [delphi-en] TObjectList.Sort issues > > > > >>Well that's gratifying news! >> >>On the speed issue you're right I'm sure - I do have to do a lot of work >>in the comparison function involving database access and XML parsing >>(it's a long story!). I might optimize that by prepopulating my objects >>with everything needed for the sort prior to calling sort() >> >>One thing I did notice when I gave it a list of 6k objects to sort was >>it gobbling up memory - it was up to 250MB from 30MB before I got tired >>of waiting and killed it. Tests with a smaller list show that my exe >>memory usage in TaskManager grows by about 750kB per sort and never goes >>down again. >> >>I don't allocate any memory in my comparison function so I wonder where >>it's going? Or is it just taskmanager misleading me..... >> >> > >Hmm no, that sounds seriously suspicious to me. It sounds to me like you >must have a memory leak somewhere along the line, if not directly in the >sort function then inside one of the things that gets called from it. Try >running the sort routine replacing the default delphi memory manager with >the MemCheck one, and see if it complains when you shut the app down. >MemCheck is available here: >http://v.mahon.free.fr/pro/freeware/memcheck/ > >I can really recommend using the MemCheck unit, I program using MemCheck >very often these days (nearly permanently), and tend to only remove it when >doing proper builds. Having it there permanently means I know really >quickly instantly when I've borked up something with respect to memory >management. It's even helped me find a bug or 2 in the VCL (for example >#11759 on qc.borland.com) so it's really worth it's salt IMHO. > >Also re your TObjectList sort awkwardness issues: This issue to me is >somewhat poor VCL design (and is actually a consequence of TObjectlist being >descended from TList.) One way of properly cleaning up the issue is to >create your own Object List class, which may be done by taking the TList and >TObject list sources and replacing references to TListSortCompare to a type >which is "of object", which will allow you to use (for example) and instance >method on your form (avoiding all the ugliness.) If you're interested in >this sort of solution and want help, then post back and I can have a quick >stab at it (it shouldn't take long to knock out a TObjectListEx that does >what you want...) > >Regards > >Walter > > > >----------------------------------------------------- >Home page: http://groups.yahoo.com/group/delphi-en/ >To unsubscribe: [EMAIL PROTECTED] >Yahoo! Groups Links > > > > > > > > > > > ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

