07-12-2010 08:47 PM
I have a large binary log file, consisting of binary data separted by header flags scattered nonuniformly thorughout the data. The file size is about 50M Byte. When I read the file into an array, I get the Labview Memory full error. The design of this is to read the file in and then parse it fro the flags to determine where to separate the data blocks in the byte stream.
There are a few examples that I have read on this site but none seem to give a straight answer for such a simple matter. Does anyone have an example of how I should approach this?
07-12-2010 09:03 PM
50 MB is not that big. You'd really have to show us a small section of the file so we can see how it is set up (such as what the header flags look like), along with your VI that is reading it.
07-13-2010 06:21 AM
Lets start with just this fundamental allocation of an arry that is 50M. This is what I get.
07-13-2010 06:25 AM - edited 07-13-2010 06:26 AM
07-13-2010 07:08 AM
I agree with Gerd. If you are working with binaries, why not use U8 instead of doubles.
If the file is indeed 50MB, then the array should be expecting 52428800 elements, not 50000000. So if you read the file in a loop and populate an element at a time, you could run out of memory fast because any additional element insertion above 50000000 may require additional memory allocation of the size above 50000000 (potentially for each iteration). This is just speculation since I don't see the portion of your code that populates the array.
Question: Why do you need an array? What do you do with the data after you read it? I agree with Altenbach, 50MB is not that big, so working with a file of such a size should not be a problem.
07-13-2010 07:24 AM
You indicate that you want to separate blocks of data separated by the headers. What is the size of the largest block which will be contained in the file? Perhaps you could read segments of that size and parse out the headers. Then retain the second header and any following bytes in a shift register to add to the next block.
As with the other responders, I agree that you should be able to read the whole file. The technique I outlined above should work on nay size file, provided the block of data will fit in memory.
Lynn
07-13-2010 08:03 AM
The array is decoded with a complex data decoder ring after it is read into memory. It is user interface selectable as to how to decode it.
07-13-2010 10:40 AM
07-13-2010 02:32 PM
How is the data passed to the decoder(s)?
How does the decoder process the data?
With more details, we can provide more appropriate suggestions.
or
Post the code as Gerd suggested.
07-13-2010 02:39 PM
Don't read the whole file at once.
Open the file as a binary file and just start reading a byte at a time until you get to what you are looking for. Then read the number of bytes you need starting at the file pointer indicated by the data foramtting of the file and then pass that sub-set of data to your "secret Decoder Ring" to process.
Ben