We help IT Professionals succeed at work.

query-related memory leak

geocoins-software
on
224 Views
Last Modified: 2010-04-05
Any help or info would be appreciated...

I have worked hard to isloate a simple example
 of query-related memory leak (cause is unknown).

When running against sql server 2005,and a query is opened, closed and freed, In many cases, the memory used by the dataset is not recovered.

We track private bytes using the performance moniter, But even the crude task moniter shows that the machine will soon lockup as memory is held (and it does).

The code below shows two different select statements. One does not cause a problem, the other does.

The statements and tables are unremarkable and quite similar.
Hmmm? (it just does create-open-free, over and over)

We use corelabs driver  3.10.8.0

We use Delphi 7 and the standard Luxena access components

This effect is not being seen with Interbase or Oracle

only against MS sql Server

var
 q: txquery;
 s: string;
begin
 WHILE TRUE DO
     BEGIN
     q:=txquery.create(nil);
     try
     q.sqlconnection:=gm_vcontrol;
    // q.sql.add('select id  from events');   //no problem - and most tables
are ok
     q.sql.add('select id from cc_late_interest '); //significant memory
loss
     q.open;
     while not q.eof  do
       begin
         s:=q.fieldbyname('id').asstring;
       q.next;
      end;
     finally
       q.free;
     end;
     END;

end;

below is the strucure of the tables


CREATE TABLE EVENTS
(
  ID INTEGER NOT NULL,
  EVENT_TYPE INTEGER DEFAULT 0,
  EVENT_INFO VARCHAR(1024),
  EVENT_DATETIME DATETIME,
  USER_ID VARCHAR(14),
  SERVER_ID INTEGER DEFAULT 0,
  BUSINESS_DATE DATETIME,
  EXPLANATION VARCHAR(1024) DEFAULT '',
 PRIMARY KEY (ID)
);


CREATE TABLE CC_LATE_INTEREST
(
  ID INTEGER NOT NULL,
  STATE VARCHAR(2) DEFAULT '',
  STATE_TITLE VARCHAR(40) DEFAULT '',
  PID VARCHAR(3) DEFAULT '',
  PID_TITLE VARCHAR(40) DEFAULT '',
  RATE NUMERIC(14, 2) DEFAULT 0,
  AFTER_DAYS INTEGER DEFAULT 0,
  TO_DAYS INTEGER DEFAULT 0,
  RECIP_TYPE VARCHAR(1) DEFAULT '',
  CLAIM_INPUT_TYPE INTEGER DEFAULT 0,
  DAYS_TYPE INTEGER DEFAULT 0,
  MINIMUM NUMERIC(14, 2) DEFAULT 0,
  MINIMUM_RECIPIENT_TAG INTEGER DEFAULT 0,
  CALCULATION_TYPE INTEGER DEFAULT 0,
  RATE_TYPE INTEGER DEFAULT 0,
 PRIMARY KEY (ID)
);
Comment
Watch Question

MerijnBSr. Software Engineer
CERTIFIED EXPERT

Commented:
so strange.

If you use either fastmm (http://sourceforge.net/projects/fastmm/?abmode=1) or the eurekalog trial (www.eurekalog.com), you might get an extra clue where the memory leaks.

Author

Commented:
Tried them all
MerijnBSr. Software Engineer
CERTIFIED EXPERT

Commented:
what did it give you?
President
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
developmentguru:

WOW, I didn't think of that. Thanks, I will give that a try and get back to you  

Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.