Hi All,
I'm writing my first Windows Mobile 5 application using C# and .NETCF2.0. I've had my ups and downs but all is going very well at present.
I've recently written a couple of File IO routines that 1) Reads INI style files 2) Reads CSV style files. I'm very concerned about the way I'm reading these files. My issue is with available system memory. The target device for this application is a HP IPaq hw6915. The device is telling me there is a mere 23Mb of available system memory. Ok, no surprises there really, there are smart devices with less. With this in mind if I read a whole 24Mb file into memory I'll saturate the device.
Now I'm not worried about the INI file reader as this reads the whole file in (Not that big in theory) store only the settings needed and then clears the memory. What I would like to do is check that this file is not too large before reading the file data in. Any clues on how to do this in the compact framework
My biggest worry is my old habit of loading everything into memory at application start-up. This is a habit I've had for years and is done to increase system performance once the application is running. I cannot do this with a 25Mb CSV file. I've currently got code reading the whole file in memory and I'm thinking this is going to catch me out! With this in mind I was going change the code to read the file data once and then get rid of it after the searching required, but even this in one whole chunk will kill the device is the file is large.
All I want to do is check for a value in the CSV style file, so common sense tells me I should read chunks at a time and check for a value in each chuck. My worry is this will have a dramatic performance hit and impose restrictions on the CSV format used. This would mean opening the file each time I needed to do a check and read each chunk every time. Am I worrying too much here I suppose this is better than loading the whole file into memory and hope I don't crash the device. Anyone got any sample of doing this kind of on the fly file seaching with .NETCF2.0
Just as I side note, I'm reading HTTP response streams into memory. I suppose I should be making sure the returned response data is not too large as well. What would be an acceptable amount of data to stream down a HTTP connection to a mobile device like this
I maybe over worried here, but I want to make sure the limited system memory on these devices does not come up and bite me on the bottom <g> I've not had to worry too much about memory for a few years.
Any advise, help would be appreciated.
TIA
Richard

Memory Efficiant Coding Practices for Mobile Devices (Should I be more careful?)
Chris_Chris__