Re: STL containers and managing memory allocation in embedded systems
- From: Zara <yozara@xxxxxxxx>
- Date: Fri, 31 Mar 2006 16:39:46 +0200
On 31 Mar 2006 13:32:07 GMT, Hans-Bernhard Broeker
<broeker@xxxxxxxxxxxxxxxxxxxxx> wrote:
In comp.arch.embedded Alex Vinokur <alexvn@xxxxxxxxxxxxxxxxxxxxx> wrote:
The memory allocation issue in embedded systems is usually critical..
It's usually beyond critical --- it's inacceptable, period. An
embedded system has nobody to complain to if an operation as strictly
internal as a memory allocation fails. So it had better not go there
at all.
If you can't afford to allow exception handling, you generally can't
allow C++ style dynamic memory handling. It's as easy as that.
How can one manage that?
Primarily by not doing it.
2. But how to manage memory allocation in containers for embedded
systems?
Primarily by not using them.
Seems too radical.
An embedded system may use perfectly dynamic memory as long as it is
able to recover from lack of memory or,at least, not enter an unstable
state. Some Denial-Of-Sservice may be allowed as long as the whole
system continues to work.
The main problem is that *every* allocation must be checked, wheteher
with exceptions or with null pointer return.
I am now working on one embedded system, and it *must* use some kind
of memory management, so as to balance resources between different
parts of the program. As I am compiling with GCC, exception throwing
is a definite no-no, becuase it neraly doubles the space used by code.
But everything works fine by using no-throw new operator and checking
its result. BTW, I am also making some test on using STL allocators to
optimize some parts of the system, spceially the multhreaded C++
kernel.
Zara
.
- Follow-Ups:
- Re: STL containers and managing memory allocation in embedded systems
- From: Paul Keinanen
- Re: STL containers and managing memory allocation in embedded systems
- Prev by Date: Building Asterisk embedded device
- Next by Date: Re: STL containers and managing memory allocation in embedded systems
- Previous by thread: Building Asterisk embedded device
- Next by thread: Re: STL containers and managing memory allocation in embedded systems
- Index(es):
Relevant Pages
|