Re: Policy on rebooting?
From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 10/08/04
- Previous message: Hopkins: "AVRISP"
- In reply to: Michael N. Moran: "Re: Policy on rebooting?"
- Next in thread: Paul Keinanen: "Re: Policy on rebooting?"
- Reply: Paul Keinanen: "Re: Policy on rebooting?"
- Reply: Alexei A. Frounze: "Re: Policy on rebooting?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 08 Oct 2004 18:53:27 GMT
"Michael N. Moran" wrote:
>> Michael N. Moran wrote:
>
... snip ...
>>
>> A production system should not have, what we called "memory block
>> promotion" enabled. This is where a larger block is given when no
>> more appropriate-size blocks are available. It is one of the hardest
>> things to tune, but really necessary. I found that determining the
>> appropriate sizes of the pools statically was impossible. Hence we
>> did it with lots and lots of testing/tuning.
>
> It seems to me that such a system with "memory block promotion"
> disabled is prone to behavior changes due to run-time variations in the
> order in which blocks of various sizes are allocated. This could wildly
> affect the memory usage efficiency, if several large blocks are
> allocated and released before small blocks, and thus limiting the
> number of small blocks available. Thus, determinism is affected.
The problem is not the use of dynamic memory, the problem is
fragmentation. Avoiding this doesn't require garbage collection,
etc, in fact that is harmful. What is required is a means of
avoiding fragmentation while preserving efficiency.
What you can do (and I have in the past) is build an allocater that
functions through indirect pointers, so that the allocation can be
moved. Then a routine can be called periodically, basically in the
idle time of the process, that advances one step towards complete
defragmentation. That means find the lowest (or highest) portion,
move it, and update what the indirect pointer points to. Sooner or
later, barring continuous allocate/free, the memory will be
compacted. So you usually have to be able to test whether there is
sufficient memory when malloc fails, and just postpone something
until it can succeed. My application timed out the use of the
storage (which was a store and forward message system) and dumped
the timed out message to the console with an undeliverable tag
attached. So we were guaranteed eventual freeing of the storage.
If you can guarantee that only one pointer to a particular block is
in play at any time, you can, in the allocation supervisory block,
replace the indirect table with a pointer back to the actual
pointer. I hope that makes sense, but I am too lazy to make an
ascii diagram.
I repeat, dynamic memory is not the problem. Fragmentation is.
-- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!
- Previous message: Hopkins: "AVRISP"
- In reply to: Michael N. Moran: "Re: Policy on rebooting?"
- Next in thread: Paul Keinanen: "Re: Policy on rebooting?"
- Reply: Paul Keinanen: "Re: Policy on rebooting?"
- Reply: Alexei A. Frounze: "Re: Policy on rebooting?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|