Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Out of memory error using wwIPStuff on large files
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Title:
Out of memory error using wwIPStuff on large files
Miscellaneous
Thread ID:
00461693
Message ID:
00461693
Views:
50
I downloaded wwIPStuff a few days ago to use in one of our applications for downloading automatic updates to our software. I was originally using MS's Internet Transfer Control, but it lacked a way to update a progress bar (not a good thing when getting >20 mb files over a modem).

I'm using httpgetex() with the wwIPStuff class control on my form. Everything appears to work fine except for large files. I was taking each lcCurrentChunk in onhttpbufferupdate() and storing it to a new element in an array. When httpgetex() returned, my code added the array elements together and spit out the binary file.

This worked fine until I tried getting a 7 mb file. I got an 'out of memory' error from FoxPro around 5,074,944 bytes. I just stopped program execution, figuring the large array was the problem. I changed the array operations to just do a StrToFile() with append set to True after getting each chunk. This also worked fine, until I tried that 7 mb file again. This time I suspended the program and saw the out of memory error was occurring in httpgetex() in the wwIPStuff class. The error is occurring on this line:


tcBuffer = tcBuffer + LEFT(lcReadBuffer,lnBytesRead)


My boss and I did some casual browsing and noticed tcBuffer=.F. LEN(lcReadBuffer) and lnBytesRead both =4096. Because of the tcBuffer=.F., our attempt to RESUME resulted in an operator/operand type mismatch.

Here's my childishly simple onhttpbufferupdate() in case you're interested. It's right from the example that comes with the class:


LPARAMETERS lnbytesdownloaded,lnbufferreads,lccurrentchunk

DO CASE
CASE lnBufferReads = 0 && First Read is the HTTP Header
=messagebox(lcCurrentChunk,"Header for: "+alltrim(THISFORM.txtUrl.Value)+alltrim(thisform.txtDir.value)+"/"+alltrim(thisform.txtFilename.value))
DoEvents
CASE lnBufferReads = -1 && Download is complete
thisform.caption="Download Complete."
OTHERWISE
DoEvents
THISFORM.caption="Downloading... "+STR(lnBytesDownloaded) + " bytes recieved."
StrToFile(m.lcCurrentChunk,ThisForm.SaveFileAs,.t.)

ENDCASE


We're not sure exactly what's going on, or why that little line would run us out of memory. Could you please help us out? Thanks.
Nick Stenz,
Junior Developer/VFP hacker
nstenz@kdsmoses.com
Next
Reply
Map
View

Click here to load this message in the networking platform