Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Barbara Peisch
  Where is Barbara Peisch?
 Oceanside
 California - United States
 Barbara Peisch
 To: TOP Matic
  Where is TOP Matic?
 Novi Sad
 Yugoslavia (former republic of)
 TOP Matic
Subject: RE: Problem with clearing memory in VFP
Thread ID: 116739 Message ID: 116945 # Views: 4 # Ratings: 0
Version: Visual FoxPro 8 Category: Other
Date: Friday, December 22, 2006 2:41:36 AM         
   



I know that some people have run VFP under a 64-bit machine, and I belive most of them were using the beta for Vista. I don't know if any were using Windows 2003 Server. That particular combination might cause a problem, but I don't know.

> Hi,
>
> all actions on a table are done before my form iz resized. And message is displayed while changing .Width property.
>
> Your doubt has sense. When my colleagues do the same on their machines, everything is OK, and no messages are displayed. Their machines have less memory than mine (around 512MB each). And I assume that this may be a problem. Sometimes I am not able to lunch another Fox window. And I get message Visual FoxPro cannot start. There is not enought memory to complete this operation...
> And not just that, I can't copy picture into clipboard (with print screen), becouse there is no eought memory!!!
>
> Very strange. On machines with much less memory than mine all this can be done. And they never get messages like me. I must admit, I am very confused. I reduced my memory on 1,5GB and again, I get the same message. When I reboot my computer and first start my app ... again ... message.
>
> Is there any chance that my application, on exit, don't clear all the memory?
>
> I forgot to mention, there is Windows 2003 Server installed on my machine, and my procesor is 64-bit architecture. I don't know, but maybe this can be the rason?!
>
> Don't know what to do!!!
> If you have any idea, please, share it with me.
>
> Regards
> Toplica
>
>
>
> > > Hi all,
> > >
> > > I have Athlon64 3000+, 2GB of RAM, and GeForce MX-440SE with 64Mb of RAM. I also made 2GB swap file. When I run VFP everything goes well. When I do SELECT or anything else on the table, and start another VFP, again OK.> I also have application written in VFP 8.0. When I start this app, i allways get the message “No enough memory to complete operation!”, but my app (I read in Task Manager) takes ~10MB of memory. This message appears for two or three times, and than all works fine. My app is wroted for touch screen displays, and has much colors and pictures on main screen. I think this is a problem with my graphic adapter, but I am not sure where is problem for sure. I tried everything guys wrote thread #116339, but again i get the same message.
> > >
> > > If you have any idea about this, please write it.
> > >
> > > Regards
> > > Toplica
> >
> > Do you know if this is happening on a SQL Select statement? That's where I've seen this before. Here's what I said about this in my white paper from my session called "But What Does That MEAN?"
> >
> > This error may actually be the result of too much memory! It seems to crop up on systems with 1 gig of memory or more. The way to solve this is to direct VFP on how much memory to allocate with the SYS(3050) function. Steve Dingle was having problems with this error, and has come up with a formula for setting SYS(3050).
> >
> >
#DEFINE  diMEM_MAX_FOREGRD       256  && The max memory to allocate
> > #DEFINE  diMEM_FOREGRD_PRECENT   .90  && Percent of memory to allocate
> >  LOCAL liNewMemory,;
> >        liAvailableMemory
> > 
> >  m.liAvailableMemory =  ( VAL( SYS(1001) ) / 4 ) / (1024^2) 
> > 
> >  m.liNewMemory = INT( m.liAvailableMemory * diMEM_FOREGRD_PRECENT )
> >  IF m.liNewMemory > diMEM_MAX_FOREGRD
> >     m.liNewMemory = diMEM_MAX_FOREGRD
> >  ENDIF
> >  
> >  m.liNewMemory =  m.liNewMemory * (1024^2)
> >  =SYS(3050, 1, m.liNewMemory )  && Set foreground memory
> >  =SYS(3050, 2, m.liNewMemory )  && Set background memory

> >
> > This code allocates 90% of memory to foreground and background buffer memory. You may want to play around with this number. You shouldn’t need to increase the maximum above 256 megs. You also probably want to make these values configurable instead of hard coding them. Then, if they need tweaking, you don’t have to change your code. Steve also notes that playing with SYS(3050) can affect your app in a negative way so you should store an “Override” option somewhere, like in an INI file. Then, check the INI file (or whatever) first for a value and if appropriate, use the formula.
> >
> > There are some additional observations from Christof Lange that help to explain things further:
> >
> > 1. You can’t really find the optimum setting for SYS(3050) because it will vary with the amount of physical memory available. That changes depending on what else the machine is running. If SYS(3050) is too low, it’s possible that VFP will start creating TMP files on disk, even though there’s plenty of memory available. If you set it too high, Windows will use paged memory, which results in a lot of disk swapping. If your TMP files are stored on a different disk from the one Windows uses for page swapping, you’re better off to err on the side of using the faster disk.
> >
> > 2. Any memory you load into the cache must be unloaded. Although unloading is faster than loading, it still takes time. The cache is unloaded when you deactivate the VFP application and the background cache is significantly smaller than the foreground cache.
> >
> > 3. There's an upper limit for SYS(3050) which is most noticeable with 1 GB or more of RAM. This problem is probably caused by the automatic determination of the buffer size. It seems that SYS(3050) is doing a file mapping which requires non-fragmented virtual memory and is limited to 2 GB for all file mappings in a process. If memory is already fragmented and/or more memory is allocated for other means, Windows might not have enough memory to create a file mapping of the calculated size or it takes away all space for further file mappings.
> >
> > If you have a process that you know requires a lot of memory, you may want to do some garbage collection at that point. Executing SYS(1104) - which performs a garbage collection - does take some time. Hence, you shouldn't call it much more than necessary. Typically, you would place it before or after operations that require lots of memory like SELECT statements or batch updates.

> >
> >
> > -BP
> > www.peisch.com



-BP
www.peisch.com

ENTIRE THREAD

Problem with clearing memory in VFP Posted by TOP Matic @ 12/20/2006 12:15:08 PM
RE: Problem with clearing memory in VFP Posted by Ilya Rabyy @ 12/20/2006 4:50:39 PM
RE: Problem with clearing memory in VFP Posted by TOP Matic @ 12/20/2006 5:14:51 PM
RE: Problem with clearing memory in VFP Posted by Ilya Rabyy @ 12/20/2006 5:44:33 PM
RE: Problem with clearing memory in VFP Posted by TOP Matic @ 12/21/2006 1:19:54 PM
RE: Problem with clearing memory in VFP Posted by Ilya Rabyy @ 12/21/2006 4:46:30 PM
RE: Problem with clearing memory in VFP Posted by TOP Matic @ 12/21/2006 5:20:17 PM
RE: Problem with clearing memory in VFP Posted by Ilya Rabyy @ 12/21/2006 5:50:09 PM
RE: Problem with clearing memory in VFP Posted by Bernard Bout @ 12/20/2006 5:25:06 PM
RE: Problem with clearing memory in VFP Posted by TOP Matic @ 12/21/2006 12:20:30 PM
RE: Problem with clearing memory in VFP Posted by Barbara Peisch @ 12/20/2006 8:27:02 PM
RE: Problem with clearing memory in VFP Posted by TOP Matic @ 12/21/2006 1:08:27 PM
RE: Problem with clearing memory in VFP Posted by Barbara Peisch @ 12/22/2006 2:41:36 AM
RE: Problem with clearing memory in VFP Posted by Tariq Iftikhar @ 4/15/2010 8:49:26 AM
RE: Problem with clearing memory in VFP Posted by Stefan Wuebbe @ 4/15/2010 10:00:19 AM
RE: Problem with clearing memory in VFP Posted by Tariq Iftikhar @ 4/15/2010 7:36:21 PM
RE: Problem with clearing memory in VFP Posted by Stefan Wuebbe @ 4/15/2010 7:44:31 PM
RE: Problem with clearing memory in VFP Posted by Tariq Iftikhar @ 4/16/2010 12:03:04 PM