> Gerry Bendixen wrote:
> On: 8 octombrie 2007 16:35
> Subject: RE: Creating new solutions
> 
> Hi all,
> The concept presented below involves loading the DB into memory.
> My question has to do with the impact on the users computer, if the
> memory is reserved for this function.
> I'm using Delphi 5.  The database could be as much as 200 MB.  The
> users could be using Win 2000, XP, or Vista.
> 1.  Does Delphi 5 handle large TStringLists adequately?

Yes and no. It will probably handle a 200 Mb string list, but what will
you do with it? I don't think a TStringList is a good data structure for
that amount of data. If you're willing to load that much stuff into RAM,
you might take the time to create a proper data structure.

> 2.  Will the DB take away from RAM or will Delphi 5 page it out to
> disk?

Unless you use very specific API calls (VirtualAlloc & friends) RAM will
come out of the Delphi mem manager. Chances are it will initially be RAM
and then get swapped to disk. Using a TStringList for 200 Mb of stuff
might prevent the RAM from getting swapped to disk because of the
sequential way you'll be accessing memory. Even if the string list is
sorted, you're still referring directly to the strings in the list and
that will most likely keep the strings in RAM.

> 3.  Are the any quirks in the operating systems that I should know
> about?

No. 200Mb is not really that much data.

> Many thanks for any details on these issue,
> Gerry B.
> 

P.S: In my opinion if you're considering keeping 200Mb worth of data
into a TStringList you should take the time to implement proper data
structures that would better serve your application. Ex: At the simplest
you should create an TObject descendent that lists all your fields
one-by-one so you're not constantly encoding and decoding strings.
You'll then be able to keep all those TObject's in a TObjectList. You
might also consider implementing an separate index for your list so you
can search for stuff without actually referring to the object in the
list itself (this gives the memory manager a chance to move data from
RAM to Swap). And of course, another good option would be to use some
kind of ready-made in-memory TDataSet descendent. I don't know if
Delphi5 has the TClientDataSet but that's a good option. Using an
TDataSet descendent gives you a good data structure specifically created
to handle large amounts of data in a way that doesn't over-stress the
memory manager (because it does not create memory fragmentation - at
least it shoudn't).

--
Cosmin Prund
__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to