🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #1229

Memory usage increase using TClientDataSet as a local temporary dataset

#1229
From: Girts
Date: Tue, 11 Apr 2000 00:00
43 lines
2111 bytes
Hi,
I am using TClient DataSet to store a results of calculations to be used in
reports, etc. I have noticed program memory usage increase, when
TClientDataSet is updated many times (thousands). I created a small example
to demonstrate the problem. CDS is a TClientDataSet containing only one
integer data field Aaa.

  CDS->CreateDataSet();
  CDS->LogChanges = false;
  for ( int i = 1; i < 10000; i++) {
     CDS->Append();
     CDS->FieldByName("Aaa")->AsInteger = i;
     CDS->Post();
  }
  for ( int i = 1; i <= 10; i++) {
      CDS->First();
      while (!CDS->Eof) {
         CDS->Edit();
         CDS->FieldByName("Aaa")->AsInteger =
CDS->FieldByName("Aaa")->AsInteger + 1;
         CDS->Post();
         CDS->Next();
      }
  }

Basically in a second for loop (on update of a field value) program memory
usage increases by 64Kb per loop according to NT task manager. I tried this
on 2 NT PC's and one Win98...
I tested the same example with CB5 trial and it works correctly (no memory
increase reported). Is this a known problem?
Also I have a similar effect using statement like
  CDS->FieldByName("Aaa")->AsInteger += 1;
increasing memory usage as opposed to (which does not)
  CDS->FieldByName("Aaa")->AsInteger = CDS->FieldByName("Aaa")->AsInteger +
1;
This problem still exists in CB5 trial as well.

I am considering swithing to kbMemTable to use as a temporary dataset, but
my trust in TClientDataSet, which I like a lot is kind of damaged...
I am using CBuilder4 with Service Pack 2.
Any solutions?

Girts
Technical Details
Message-ID: <8cv4sm$mj41@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,49a90407f34ccd9a,start
X-Google-Attributes: gidfcd2b,public
From: "Girts" <girts@vivasport.lv>
Subject: Memory usage increase using TClientDataSet as a local temporary dataset
Date: 2000/04/11
Message-ID: <8cv4sm$mj41@bornews.borland.com>
X-Deja-AN: 609620603
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.cppbuilder.database.multi-tier