News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Reallocation ByteArray

Started by AssemblyBeginner, October 12, 2006, 05:00:34 PM

Previous topic - Next topic

AssemblyBeginner

hi everyone

i have made a small parser that can read some bytes from a file,parsing these bytes & write them to some other file,it continues performs these operations until it reaches EOF.

but instead of reading->parsing->writing, i want to read bytes,parsing them and store them in a byte array until it reaches EOF instead of wiring in another file as i doing before.

my problem is how can i reallocate that byte array & concatenate parsed bytes
while doing this whole operation.

as what i m doing now,read->parse->write to file operation is going fast, so plz advice me,how i acheive that much or higher speed with read->parse->byte array

the size of the input file to this parser me in 1-2 gb's also so plz consiseder this also.

thanks in advance and hope for good comments

asmfan

For those purposes i'd suggested using MMF - memory mapped files. The file will be like the byte array in memory.
Russia is a weird place

zooba

For something of that size probably what you are already doing is best. Memory mapped files can be used later to access your parsed version, but you probably don't want to try and allocate 2GB of memory - sending it straight to the hard drive will be quicker and easier. You can then map the file into memory and access it like a byte array, though if you want sequential access reading a small amount into a buffer will again be simpler.

If you will need to modify the parsed file, use memory mapping. I believe there are some good examples on the forum, try search.

Cheers,

Zooba :U