Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A memory leak in VFP?
Message
From
14/03/2008 11:34:49
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
A memory leak in VFP?
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01302148
Message ID:
01302148
Views:
65
Is this a memory leak? Go to Microsofts Sysinternals page:
http://technet.microsoft.com/en-us/sysinternals/0e18b180-9b7a-4c49-8120-c47c5a693683.aspx

Download the Process Explorer tool. Copy the following code to a PRG and then open the prg in VFP. Start Process Explorer and select your VFP process. Open the "Performance" tab and notice the allocated "Private Bytes" and the current number of "Page Faults". Now start to run the PRG. If, you have your "Paging file size" set to custom (Mine came defaulted to 768 MB initial and 1536 MB max) you will start seeing TONS of page faults that will over the space of a few minutes begin to drive up memory usage. Your memory usage will continue to climb until the process becomes unresponsive! When I set my "Paging file size" to "System Managed" the problem almost went away. It seems like some sort of memory fragmentation issue possably.

What do you think?

Steve

*--- Start Test Code ------------------------------------------------------

CLEAR

*---------------------------------------------------------
* Declare Windows API Functions
*---------------------------------------------------------
DECLARE INTEGER Sleep ;
IN Win32API INTEGER
*---------------------------------------------------------

IF NOT FILE("TEST.DBF")
CREATE TABLE TEST (C1 C(200))
ELSE
USE TEST
ENDIF

SET ESCAPE ON
m.cPacket = REPLICATE(REPLICATE(REPLICATE("X",1024),1024),10) && 10 Meg Packet
*m.cPacket = REPLICATE("X",1024) && 1k Packet
npeerid = 0
nchannelid = 0
cType = ""
m.iLoopCounter = 0
DO WHILE NOT LASTKEY() = 27
m.iLoopCounter = m.iLoopCounter + 1
SELECT TEST
APPEND BLANK
REPLACE C1 WITH TTOC(DATETIME()) + " - " + SYS(1016) + "/" + SYS(1001)
SENDPACKET(m.cPacket, m.npeerid, nchannelid, cType)
IF m.iLoopCounter > 10
SLEEP(100)
ENDIF
DOEVENTS
ENDDO


*---------------------------------------------------------
* Program :
* Author : Steve Stamm
* Date : 03/10/06 11:17:38 AM
* Copyright : DPRA 2006
* Description:
* Rev Info : 03/10/06 - Steve Stamm
*---------------------------------------------------------
PROCEDURE SENDPACKET(packetdata, npeerid, nchannelid, cType)
Next
Reply
Map
View

Click here to load this message in the networking platform