Re: Leaving files open on CE device 100% of the time

From: Michael J. Salamone [eMVP] (mikesa#at#entrek#dot#com)
Date: 03/17/04


Date: Wed, 17 Mar 2004 05:13:55 -0800

That's not a problem. The OS doesn't just kill your app, it sends WM_CLOSE.
You have an opportunity, then, to free up resources, flush buffers (if you
have your own internal buffering), close files, etc.

Additionally, data you write is immediately commited to storage, because
there is no file system caching in CE (at least not any file system I am
aware of). So even if the OS did zap you, your data will be on disk (unless
you have your own internal buffering, and didn't actually do the write).

-- 
Have an opinion on the effectiveness of Microsoft Embedded newsgroups? Tell
Microsoft!
https://www.windowsembeddedeval.com/community/newsgroups
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Stephen Bye" <.> wrote in message
news:OdlCQlBDEHA.2920@TK2MSFTNGP09.phx.gbl...
> If the OS needs to close your application to free up memory, or if the
user
> does a soft reset, then you will lose the contents of the file if the file
> is open.
> It would probably be better to keep all of the data in memory (if that is
> possible), and write it to the file when it is changed. If that would be
too
> often, you could check every 10 minutes, say, if the data has changed
since
> the last time you saved it, and write it then.
>
> "CheshireCat" <blahhh@blahhhhh.com> wrote in message
> news:uiP3$yADEHA.3280@TK2MSFTNGP09.phx.gbl...
> > Can anyone give me reasons why I shouldn't open a data file at the time
my
> > data handling object is created, closing it again on it's destructor.
The
> > file is a data file and the object reads and writes to it over its
> lifetime.
> > Or would it be safer to keep opening/closing the file as I need it.
> > There will be 4 persistent instances of the object in the application.
The
> > application will be running 100% of the time as this is a dedicated app
> for
> > the CE device . The data has to be safe etc. The file would only be
closed
> > when a replacement data file is downloaded to the handheld.
> > I want to do it this way to keep speed up, cut down on the amount of
> > coding/error checking and to keep the application footprint as small as
> > possible.
> >
> >
> >
>
>


Relevant Pages

  • Re: simple read char app return wrong value?
    ... shouldnt kernel remove all the pending input for readc before handing bash control? ... Then there's fopen, fread, fwritewhich use a "*FILE" - these ones do internal buffering, and definitely do some flushing. ... so why doesnt the app return 4 instead of 0? ...
    (alt.lang.asm)
  • Re: Double Buffering and Initial Paint
    ... > when I turn on double buffering ... ... > the control which is being double buffered momentarily has the same ... > When this is set to false, flickering once again occurs, but the ... > my app, but STILL not have any flicker. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Weird Java 6 Double-buffering Problem
    ... I'm having a printing issue since upgrading my Swing app from JDK1.4.2_06 to JDK6.0. ... As many of you may know, before printing, one must disable double buffering. ... Ever since I upgraded my app, my JTable components have been experiencing this exact problem. ... I confirmed that double buffering is disabled both by setting breakpoints in my JTable cell renderer and noticing that my app flickers badly with any onscreen rendering. ...
    (comp.lang.java.gui)
  • Re: memory usage minimized
    ... I have developed an app that uses alot of double buffered forms. ... Does garbage collection get triggered when you minimize? ... Is the double buffering using garbage collected ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Memory Limits?
    ... If the app is writing directly to ... I shouldn't even be having that memory problem. ... instead of buffering the file to memory. ... Unfortunately, this is old DOS code that was ported to Windows, later ported ...
    (microsoft.public.pocketpc.developer)