Page 1 of 1

Application slow down/Memory Leak

Posted: Fri Mar 18, 2011 11:54 am
by PeterHarmes
Hi,

One of my customers have been experiencing a performance drop in our application and after a few tests, we have noticed that the slow down occurs when the Mem Usage (reported by task manager) reaches a certain figure.

I noticed that I could open a simple dialog box and close it and the memory would increase and would never be recovered. The dialog box opened is very simple - One Say and a button - no fonts or bitmaps used.

Uwe sent me a memory application that when run, my users said that it seemed to help with performance, so I have tried to create my own version of the application withing my application:

The code for this is:

Code: Select all


FUNCTION MemoryFlush 
    SetProcess( -1, -1, -1)
RETURN NIL

DLL32 Function SetProcess( ;
   hWnd As LONG, nMinWorkingSpace As LONG, nMaxWorkingSpace As LONG ) ;
   As LONG PASCAL From "SetProcessWorkingSetSize" Lib "Kernel32.dll"

 

I then call MemoryFlush() within a common routine (in my app, the routine that reads my text data dictionary)

So far, we have tested tmy app in a test environment with a single user and it seems to work quite well - I noticed that the mem usage value was being clawed back.

We are now testing my app in a live environment, so I will let you all know if we have any success.

If this is successful, I would like to change my memoryflush routine to only run if the memory usage is over a set value - does anyone know how get the mem usage value of your application?

Regards,

Pete

Re: Application slow down/Memory Leak

Posted: Sat Mar 19, 2011 2:11 pm
by MGA
Thanks Peter...

Re: Application slow down/Memory Leak

Posted: Sun Mar 20, 2011 3:58 pm
by toninhofwi
Hi Pete.

Thanks for share it.


>does anyone know how get the mem usage value of your application?

Please review: \harbour\tests\memtst.prg


Toninho.

Re: Application slow down/Memory Leak

Posted: Mon Mar 21, 2011 1:27 pm
by mgsoft
Peter,

What is the reason of the memory high use?.

Have you checked with Checkres() if there are any memory leaks?.

Thank you for your important point.

Re: Application slow down/Memory Leak

Posted: Fri May 13, 2011 8:21 pm
by MGA
Hello PeterHarmes,

In their tests in a real environment, you have succeeded in using the function: memoryflush?

Thanks

Re: Application slow down/Memory Leak

Posted: Sun May 15, 2011 1:03 pm
by Silvio
one of problems are resources specialy on windows seven systems

to resolve this leak problems I not use resources

only for bitmaps but If I can i save the bitmaps on a folder and call them when I use them

I rewrite also rpreview dialogs into @x,y source

I use only freeimage.dll calls

Re: Application slow down/Memory Leak

Posted: Mon May 16, 2011 11:01 am
by MGA
thanks