Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 16 total
Thread Memory Table - Memory not getting released back
Tue, Nov 17 2009 5:49 AMPermanent Link

Ahamed Saajid
Hi,

I have created a small project to demonstrate- Memory not freeing after Delete or Drop of the table of Memory table.

Could you please check and let me know 'how to clear' the table.

This is causing a big problem in my application as Memory tables are created for each report with field structure and will be used throughout
the application. To clear the memory, we are deleting the records from memory table but its not resulting in freeing up of the memory space.

This is causing major issue on Citrix, as the whole memory is getting consumed by the application.



Attachments: MemoryTestProject.rar
Tue, Nov 17 2009 7:38 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ahamed


You don't say which version of DBISAM you're using. I'm guessing its not the current one since you use "MEMORY tablename" rather than "memory\tablename".

There are problems with your demo app. The insert test doesn't work because whilst you create the table there's no structure there. Having said that if I adjust the format to V4 (I'm using 4.25) and run in D6 the only leaks reported are


13 - 20 bytes: TObjectList x 3, Unknown x 3
29 - 36 bytes: TWinHelpViewer x 1
45 - 52 bytes: THelpManager x 1

Which are nothing to do with DBISAM.

So to help us to help you can you let us know what version you're using, and add something like this

if DebugHook <> 0 then begin
 ReportMemoryLeaksOnShutdown := True;
 SetMMLogFileName(PChar('C:\zap\Leaks.txt'));
end;

as the first bit of code in the .dpr's begin..end block and post the result.

Finally please post attachments over a couple of Kb in size to the binaries


Roy Lambert [Team Elevate]
Tue, Nov 17 2009 10:55 PMPermanent Link

Ahamed Saajid
Hi,

<<You don't say which version of DBISAM you're using. I'm guessing its not the current one since you use "MEMORY tablename" rather
than "memory\tablename".>>

The version we are using is DBISAM 3.24 with Delphi 5 Enterprise.

<<There are problems with your demo app. The insert test doesn't work because whilst you create the table there's no structure there. Having
said that if I adjust the format to V4 (I'm using 4.25) and run in D6 the only leaks reported are

13 - 20 bytes: TObjectList x 3, Unknown x 3
29 - 36 bytes: TWinHelpViewer x 1
45 - 52 bytes: THelpManager x 1 >>

Table structure is included on the Table component tblTestMem as fieldDefs. If you monitor TaskManager->Processes and click on the INSERT
button, data gets inserted into the memory table and Mem usuage increases in TaskManager->Processes tab. When we click on Delete button,
it delete records but the memory is not released. Even after dropping the table, the memory occupied by the Memory table is not getting
released. It goes on increasing whenever data is populated but not getting released after deleting those records or after dropping the table.

Which are nothing to do with DBISAM.

<<So to help us to help you can you let us know what version you're using, and add something like this
if DebugHook <> 0 then begin
 ReportMemoryLeaksOnShutdown := True;
 SetMMLogFileName(PChar('C:\zap\Leaks.txt'));
end;
as the first bit of code in the .dpr's begin..end block and post the result.>>

Its giving error if i include the lines. Which is the unit that need to be included in the dpr?

<<Finally please post attachments over a couple of Kb in size to the binaries>>
Ok....

Regards
Ahamed Saajid
Wed, Nov 18 2009 2:35 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ahamed


>Table structure is included on the Table component tblTestMem as fieldDefs. If you monitor TaskManager->Processes and click on the INSERT
>button, data gets inserted into the memory table and Mem usuage increases in TaskManager->Processes tab. When we click on Delete button,
>it delete records but the memory is not released. Even after dropping the table, the memory occupied by the Memory table is not getting
>released. It goes on increasing whenever data is populated but not getting released after deleting those records or after dropping the table.

Task Manager is not the best tool to monitor memory usage. What its actually showing is Windows memory management not the apps. When an app asks Windows for memory it gets allocated a block, when its finished with it the app MAY release it back to Windows or keep it in case its needed again. Even when it releases it Windows may not immediately add it back into the free memory queue, often because the queue has become fragmented (which again makes it look as though memory is still being used). The way Windows actually allocates memory can also be a problem.

><<So to help us to help you can you let us know what version you're using, and add something like this
>if DebugHook <> 0 then begin
>  ReportMemoryLeaksOnShutdown := True;
>  SetMMLogFileName(PChar('C:\zap\Leaks.txt'));
>end;
>as the first bit of code in the .dpr's begin..end block and post the result.>>
>
>Its giving error if i include the lines. Which is the unit that need to be included in the dpr?

You need to be using the debug version of FastMM not the standard version.

Roy Lambert [Team Elevate]
Wed, Nov 18 2009 5:19 AMPermanent Link

Ahamed Saajid
Roy Lambert wrote:

Ahamed

<<Task Manager is not the best tool to monitor memory usage. What its actually showing is Windows memory management not the apps.
When an app asks Windows for memory it gets allocated a block, when its finished with it the app MAY release it back to Windows or keep it in
case its needed again. Even when it releases it Windows may not immediately add it back into the free memory queue, often because the
queue has become fragmented (which again makes it look as though memory is still being used). The way Windows actually allocates memory
can also be a problem.>>

Is there a way to determine the source of issue...windows or application?
From the code you might have seen the straight forward method used...but still the DROP table or DELETE records from table are not freeing
memory. Is this problem because of windows?
If the problem is from Windows...is there a solution..


<<So to help us to help you can you let us know what version you're using, and add something like this
if DebugHook <> 0 then begin
 ReportMemoryLeaksOnShutdown := True;
 SetMMLogFileName(PChar('C:\zap\Leaks.txt'));
end;
as the first bit of code in the .dpr's begin..end block and post the result.
Its giving error if i include the lines. Which is the unit that need to be included in the dpr?
You need to be using the debug version of FastMM not the standard version.>>

Can you send us the link to download the debug version...and ohw to incorporate it into application

Please consider this as high priority.


Ahamed Saajid
Wed, Nov 18 2009 5:45 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ahamed

>Is there a way to determine the source of issue...windows or application?

Not that I know of, but from comments made by Tim in previous posts its almost certainly Windows.

>From the code you might have seen the straight forward method used...but still the DROP table or DELETE records from table are not freeing
>memory. Is this problem because of windows?

I don't know - see above

>If the problem is from Windows...is there a solution..

Not as far as I know.

Why is it a problem? How much memory is being consumed / not released?


>Can you send us the link to download the debug version...and ohw to incorporate it into application

Zip sent to your email address

>Please consider this as high priority.

Just so you know anyone with a [Team Elevate] tag line to their sig doesn't work for ElevateSoft, we're just users like yourself giving for free our spare time.

Roy Lambert [Team Elevate]
Wed, Nov 18 2009 7:02 AMPermanent Link

Ahamed Saajid
Can i use some free tools which clean up RAM..i found one in below link:
http://www.memoryimprovemaster.com/download_free_memory_improve.htm


<<Why is it a problem? How much memory is being consumed / not released?>>
Its increases based on the operation performed in application.A screen gets populated from Memory table and when user goes to next record ,
it deletes the current record and inserts the next. Since the delete is not freeing up memory and insert is consuming memory...it goes on
increasing...When the applicationis deployed on Citrix, the available memory gets consumed and it starts to use page...hitting performace and
printer problem on citrix. Each user is consuming above 500 MB(depends on operations performed)...and we have more than 20 users on citrix.

Thanks for sending the Debug FastMM version

Regards
Ahamed Saajid
Wed, Nov 18 2009 8:05 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ahamed

>Can i use some free tools which clean up RAM..i found one in below link:
>http://www.memoryimprovemaster.com/download_free_memory_improve.htm

No idea. Try it and see what happens.

><<Why is it a problem? How much memory is being consumed / not released?>>
>Its increases based on the operation performed in application.A screen gets populated from Memory table and when user goes to next record ,
>it deletes the current record and inserts the next. Since the delete is not freeing up memory and insert is consuming memory...it goes on
>increasing...When the applicationis deployed on Citrix, the available memory gets consumed and it starts to use page...hitting performace and
>printer problem on citrix. Each user is consuming above 500 MB(depends on operations performed)...and we have more than 20 users on citrix.

It may be an interaction with Citrix that's the problem. What happens with your app if you run it on a "real" pc? DO you still have memory issues?

>Thanks for sending the Debug FastMM version

No problem

Roy Lambert [Team Elevate]
Wed, Nov 18 2009 11:09 AMPermanent Link

"Raul"
FYI:

Process Explorer (from sysinternals) provides a lot better reporting on
process memory use :
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
Might help narrowing down the allocation problem - specifically if it shows
memory usage decreasing then your app is freeing it.


Also latest version of FastMM4 is always available from SourceForge :
http://sourceforge.net/projects/fastmm/

Raul

Thu, Nov 19 2009 12:52 AMPermanent Link

Ahamed Saajid
Hi,

<<It may be an interaction with Citrix that's the problem. What happens with your app if you run it on a "real" pc? DO you still have memory
issues?>>

The problem exists in real PC as well and the MEM consumption goes above 500 MB. The issue is not getting highlighted because in normal
mode (client - server) , the memory usage gets distributed on the client PCs. In Citrix, the clients instances are all on one high end machine.
But even on that, the memory gets into a bottleneck state since the application is not releasing memory(or may be Windows not adding it to
free MEM pool though the app frees it)...I think its not releasing memory from the memory table, everywhere else it works.

Any ideas/suggestion is welcome


Regards
Ahamed Saajid
Page 1 of 2Next Page »
Jump to Page:  1 2
Image