Hi

Firstly apologies for a long post, but really stumped.

I have an application written in VFP9 SP1, backend SQL Server 2000.
This runs on Windows 2003 Terminal Server, and developed on a Windows
2000 PC.

We now have problems with memory usage and the dreaded "Visual Foxpro
has encountered a problem and needs to close" which happens every now
and again.

The application allows users to open multiple forms within the _SCREEN
environment.

When opening and closing one screen, memory usage is OK and stable,
i.e. gets allocated and released when viewed in Windows task manager
with only miminal increases).

However, if a user opens multiple windows (forms), then the memory
usage gradually goes up and up.

For example (using windows task manager)

Form 1 - 15688 K
Form 1 & 2 - 18756 K
Close Form 2 - 17756 K
Open Form 2 - 18992 K
Close Form 2 - 18652 K
Open Form 2 - 19016 K
Close Form 2 - 18624 K

So you can see, with continued use with numerous forms, the usage goes
up and the application slows down.

Following this, I used the Sys(1011) function and got these results:

Form 1 - 3930
Form 1 & 2 - 6360
Close Form 2 - 3952
Open Form 2 - 6381
Close Form 2 - 3974

So this goes up as well.

---------------------------------------------------------------------------

Now, when a form is released, surley all memory is released and
allocated back.

So I added a SYS(1104) to make sure but this had no impact on memory
in task manager.

Anybody got any ideas or pointers?

Many Thanks

---------------------------------------------------------------------------

Re: Form Memory Usage/Release by pdorotiak

pdorotiak
Fri Oct 05 02:52:35 PDT 2007



Nobody any ideas or pointers?

Cheers


Re: Form Memory Usage/Release by Roger

Roger
Fri Oct 05 09:21:13 PDT 2007


<pdorotiak@aspectit.net> wrote in message
news:1191577955.827883.69090@g4g2000hsf.googlegroups.com...
>
>
> Nobody any ideas or pointers?

Under normal circumstances, VFP doesn't leak memory when
opening and closing forms. Memory usage can increase as a result
of caching but this normally levels out after a form has been
opened the second time.

The Task Manager isn't very useful when trying to detect
memory leaks as Windows does its own memory shuffling which
is outside of your control. This is easily demonstrated by
comparing TM memory before and after VFP had been minimized.

Your example using Sys(1011) looks fishy but I'd have like to
have seen the results from a few more form openings and closings.

Just a WAG ... it might be that you're not explicitly releasing
file and/or connection handles. Without more info about what goes
on in your forms, it's impossible to be more specific.

-Roger




Re: Form Memory Usage/Release by bork

bork
Fri Oct 05 20:55:40 PDT 2007

How high will memory consumption go in your tests? VFP can grab quite a
large chunk of memory, but my experience has been that

1) VFP doesn't leak unless you are using external modules or connection via
DDE or OLE. Then it can leak like a sieve. I have an app that uses functions
in gdiplus.dll, and it leaks to the point where I had to have the main app
call a secondary app to do the gdi processing, and then terminate to release
the memory. I had another app that used some functions from a DLL written in
c++ - leaked badly, we never did find the cause of the leak. Finally gave up
and just forced the app to restart every 24 hours. Problem solved :P

2) VFP can grap a large chunk of memory, but will eventually stabalize. I
seem to recall this being well in excess of 100MB. If you are having
problems before at least that much memory is consumed, your problem is not
caused by excess memory consumption.

3) Test it running outside of terminal server session, make sure it isn't
something to do with the TS session that is causing the problem.



<pdorotiak@aspectit.net> wrote in message
news:1191241507.152275.126890@n39g2000hsh.googlegroups.com...
>
> Hi
>
> Firstly apologies for a long post, but really stumped.
>
> I have an application written in VFP9 SP1, backend SQL Server 2000.
> This runs on Windows 2003 Terminal Server, and developed on a Windows
> 2000 PC.
>
> We now have problems with memory usage and the dreaded "Visual Foxpro
> has encountered a problem and needs to close" which happens every now
> and again.
>
> The application allows users to open multiple forms within the _SCREEN
> environment.
>
> When opening and closing one screen, memory usage is OK and stable,
> i.e. gets allocated and released when viewed in Windows task manager
> with only miminal increases).
>
> However, if a user opens multiple windows (forms), then the memory
> usage gradually goes up and up.
>
> For example (using windows task manager)
>
> Form 1 - 15688 K
> Form 1 & 2 - 18756 K
> Close Form 2 - 17756 K
> Open Form 2 - 18992 K
> Close Form 2 - 18652 K
> Open Form 2 - 19016 K
> Close Form 2 - 18624 K
>
> So you can see, with continued use with numerous forms, the usage goes
> up and the application slows down.
>
> Following this, I used the Sys(1011) function and got these results:
>
> Form 1 - 3930
> Form 1 & 2 - 6360
> Close Form 2 - 3952
> Open Form 2 - 6381
> Close Form 2 - 3974
>
> So this goes up as well.
>
> ---------------------------------------------------------------------------
>
> Now, when a form is released, surley all memory is released and
> allocated back.
>
> So I added a SYS(1104) to make sure but this had no impact on memory
> in task manager.
>
> Anybody got any ideas or pointers?
>
> Many Thanks
>
> ---------------------------------------------------------------------------
>