Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 23 total
Thread Problems with memory
Thu, May 15 2008 2:24 PMPermanent Link

Saul_fg
Good day:

I have a procedure to extract data from a remote table into a local table, including blob fields:

with QF, QF.SQL do begin
     Close;
     Clear;
     Add('Select empleado, clave, nombre, documento, archivo, fecha, usuario');
     Add('from nom115');
     Add('where empleado='+inttostr(_Numero));
     Open;
     if RecordCount>0 then begin
       First;
       while not eof do begin
         TLDoctos.Insert;
         TLDoctos.FieldByName('empleado').AsInteger:=FieldByName('empleado').AsInteger;
         TLDoctos.FieldByName('clave').AsInteger:=FieldByName('clave').AsInteger;
         TLDoctos.FieldByName('nombre').AsString:=FieldByName('nombre').AsString;
         st := TMemoryStream.Create ;
         QFDocumento.SaveToStream(st);
         TLDoctosdocumento.LoadFromStream(st);
         st.Free();
         TLDoctos.FieldByName('archivo').AsString:=FieldByName('archivo').AsString;
         TLDoctos.FieldByName('fecha').AsDateTime:=FieldByName('fecha').AsDateTime;
         TLDoctos.FieldByName('usuario').AsString:=FieldByName('usuario').AsString;
         TLDoctos.Post;
         Next;
       end;
     end;

When the Blob Field contains a file over the 10 MB and in another form open a table the memory usage's up to 700MB more. This only happend
using the app in a C/S mode, if I run the app in a not C/S mode, there is no problem.
Fri, May 16 2008 12:45 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Saul,

<< When the Blob Field contains a file over the 10 MB and in another form
open a table the memory usage's up to 700MB more. This only happend using
the app in a C/S mode, if I run the app in a not C/S mode, there is no
problem. >>

What version of DBISAM are you using ?   Also, what memory usage are you
monitoring - the application side or the server side ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, May 16 2008 2:51 PMPermanent Link

Saul_fg
Hi Tim, I'm using 4.25 Build 6 and I'm monitoring the application side.


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Saul,

<< When the Blob Field contains a file over the 10 MB and in another form
open a table the memory usage's up to 700MB more. This only happend using
the app in a C/S mode, if I run the app in a not C/S mode, there is no
problem. >>

What version of DBISAM are you using ?   Also, what memory usage are you
monitoring - the application side or the server side ?

--
Tim Young
Elevate Software
www.elevatesoft.com
Mon, May 19 2008 12:54 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Saul,

<< Hi Tim, I'm using 4.25 Build 6 and I'm monitoring the application side.
>>

I forgot one other question - are you monitoring the memory via the task
manager ?  If so, which statistic column are you monitoring ?

The issue may just be down to the way the TMemoryStream works - it has to
re-allocate it's contents constantly as the stream grows organically, so
this may be fragementing the virtual memory address space for the
application.  One thing you may try doing is setting the Capacity property
of the TMemoryStream *prior* to saving the stream to it.  You have to write
a descendant class the promotes the protected Capacity property first,
however:

 TMyMemoryStream = class(TMemoryStream)
 public
   property Capacity;
 end;

Then, set it to something like 16 megs before saving the stream to it.

Then run your application again and check and see what the memory
consumption looks like.  It should be a bit smaller.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, May 21 2008 10:49 AMPermanent Link

Saul_fg
Tim,

"You have to write
a descendant class the promotes the protected Capacity property first,
however:

 TMyMemoryStream = class(TMemoryStream)
 public
   property Capacity;
 end;

Then, set it to something like 16 megs before saving the stream to it."

Could you give me an example of that? thanks.
Wed, May 21 2008 2:30 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Saul,

<< Could you give me an example of that? thanks. >>

An example of what ?  Setting the Capacity property ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, May 21 2008 6:35 PMPermanent Link

Saul_fg
Tim

<<An example of what ?  Setting the Capacity property ?>>

That's right and also where do I have to define the class, I mean in which part of my code?

Thanks
Thu, May 22 2008 11:30 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Saul,

<< That's right and also where do I have to define the class, I mean in
which part of my code? >>

You define the object in the interface portion of any unit that you wish:

interface

TMyMemoryStream = class(TMemoryStream)
 public
   property Capacity;
 end;

implementation

And you then use it like this:

var
  MyMemoryStream: TMyMemoryStream;
begin
  MyMemoryStream:=TMyMemoryStream.Create;
  MyMemoryStream.Capacity:=16000000;
  ....
end;

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, May 22 2008 6:53 PMPermanent Link

Saul_fg
Tim

<< You define the object in the interface portion of any unit that you wish:

interface

TMyMemoryStream = class(TMemoryStream)
 public
   property Capacity;
 end;

implementation

And you then use it like this:

var
  MyMemoryStream: TMyMemoryStream;
begin
  MyMemoryStream:=TMyMemoryStream.Create;
  MyMemoryStream.Capacity:=16000000;
  ....
end;>>

I did try this option and still the same problem.

What else can I do to solve this situation?
Thu, May 22 2008 9:13 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Saul,

<< I did try this option and still the same problem. >>

You didn't answer my prior question:

Are you monitoring the memory via the task manager ?  If so, which statistic
column are you monitoring ?

This is important, because if you're still seeing the same amount of memory
consumption, then most likely it isn't related to the memory stream.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 3Next Page
Jump to Page:  1 2 3
Image