Re: Fragmentation: Is there a solution yet?

"Jim Rudnicki" <jdrlist-3i//[email protected]> Wed, 2 Jun 2004 16:24:37 -0700
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <000a01c448f8$c5e895a0$3301a8c0@t600>
> Our application is doing bunch of file creation and deletion to save
> intermediate configurations/reports etc. And these I guess is leading to
> fragmentation problem causing insufficient heap.
...
> I will greatly appreciate any hint/direction to solve this problem.

You don't want this advice, but I honestly think your problem is only truly
solved by changing the design:  stay off the heap -- instead reuse.

What you face is a problem common to all firmware: if you are constantly
allocating and deallocating, there is no way to guarantee that the system
can run indefinitely.  You are stuck in your position, _hoping_ that the
heap manager will allocate in a certain way.  Or, you have to develop your
own heap manager that uses knowledge of the specific application to provide
deterministic behavior.

In your case, a reuse/recycle approach is to lay down a pool of files of
appropriate size when the application starts.  While the app runs, it just
reads and writes to these, never changing their size/names.  This probably
means, you have to stop using the stream readers & writers and change to
random access.  This type of approach leads to a behavior you need for a
product: if it boots, it will run _forever_.

Second, consider why you are using the file system at all.  The TINI is a
slightly different beast in that the file store is in the same RAM as the
JVM.  I don't know the specifics of your app, but storing intermediate
results in the file store may be of no benefit to just keeping the results
in memory.

Jim




_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini