Memory and file management

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have to develop an application on WinCE with VS.net 2003.

My application will have to manage file (i.e. my data are saved on file and
when I open a file I would like to read them and work with them; when I exit
from the application I have to save the modification again to file).

My question is: I have to read the data from the file and put them to memory
and, at the end, I have to save the data from memory to file ? Or, because
the file are not saved on disk but on memory itself, I can simply open the
file and read and write directly to file ?

In other words it is necessary, for speed reasons, move the data from the
file to memory or not ? The access speed on file is the same access speed on
memory ?

Do you have any link to documentation, articles, ..., that explain memory
and file management on WinCE ?

Thank you in advance.

Keven Corazza
 
As far as I know, this is no different in .NET than what it is with other
technologies.

You can read the data faster from memory. If you read from file and save to
file as you go along, you sacrifice speed for memory usage and you probably
stand less chances losing data (e.g. if you put everything in memory and
only save in the end, what would happen if your app died in between?).

Without getting into the project specifics no-one can provide specific
advice. How large is the data, what is the file (e.g. CSV, XML, binary), how
often do you need to save back, how much of it does your app need at runtime
etc

As a default approach, I would have some kind of object model that
represents the data in an app-friendly way and can read/write itself to file
(whether it does this on initialisation or on demand is then an optimisation
exercise). How much of this model gets loaded and how much of it gets
reused/pooled is your decision.

Cheers
Daniel
 
There's no way that we can give a definitive answer to that question. We
know *nothing* about the access patterns of the data, what you do to it, or
how fast the file storage is.

If the data is bigger than 32MB, you will *definitely* have to work from the
file storage, as the size of the memory partition for an application is
32MB. The actual size at which you will have to work with the file is
actually a lot smaller than that, but that's a hard limit.

File access works pretty much just like it does on the desktop. The actual
storage is seldom a hard disk, but that's transparent to you.

Paul T.
 
Back
Top