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
Miscellaneous
Thread ID:
00461693
Message ID:
00462692
Views:
16
Well, tcBuffer is .F. because the assignment fails at some point and it reverts to its default value. So that's to be expected.

I think you're simply running out of memory with strings this large. The strings are duplicated in a couple of places which makes a 7 meg file more like 21megs of usage. And although you may have it VFP may not have that memory allocated and ready to give to you in one chunk.

There are a couple of things you can do - is use a MEMO field to hold the buffer instead since that will dump to disk as needed instead of keeping the whole thing in memory.

The other thing is to break down the files into smaller chunks to send. Honestly I wouldn't send more than a couple of megs over HTTP in general.

Also, try making sure that you use nHTTPPostMode multipart to avoid encoding the strings when sending the data.

+++ Rick ---

>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.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform