Re: Unrecoverable error 332 string/array memory overflow
- From: "Stephen Quinn" <steveq@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Jun 2006 02:30:46 GMT
Mel
When you AADD() to an array the existing array is copied with the extra amount
of memory added for the new element, so doing that involves a lot of memory
being moved around.
If you allocate enough elements to your arrays beforehand then you should not
see the problem.
Eg
aLines := ARRAY( 2400 )
i := 1
aLine := (csvarray(cLine) )
aLines[ i ] := aLine
IF i = 2400
// Write the array to DBF
UpdateDBF( aLines )
aFill( aLines, '' )
i := 1
ENDIF
Putting something like
@ 0,0 SAY ''
inside your loop will give the GC a chance to kick in to clean up memory.
You could also change to structure of the code to only require a single array.
Eg
aLine := (csvarray(cLine) )
// Write the array to DBF
UpdateDBF( aLine )
Another way is to allocate a buffer that you append your data to and write it
when the buffers full, this is done by opening the DBF as a file
(FOpen()/FWrite()/FClose()) not as a database (USE).
Take a look at CLICK! source on the OASIS to see some fast routines for doing
this.
HTH
Steve
.
- Follow-Ups:
- Re: Unrecoverable error 332 string/array memory overflow
- From: Mel Smith
- Re: Unrecoverable error 332 string/array memory overflow
- References:
- Unrecoverable error 332 string/array memory overflow
- From: Mel Smith
- Unrecoverable error 332 string/array memory overflow
- Prev by Date: Unrecoverable error 332 string/array memory overflow
- Next by Date: How to create composite CDX index?
- Previous by thread: Unrecoverable error 332 string/array memory overflow
- Next by thread: Re: Unrecoverable error 332 string/array memory overflow
- Index(es):
Relevant Pages
|
Loading