This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about empty C++delete functions


On Fri, Aug 30, 2002 at 06:43:19PM +0200, Joris Roussel wrote:
> Dear all,
> 
> I have a question about the "Provide empty C++ delete functions" 
> (CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS) option of eCos configuration.
> 
> If I keep it to its default value (enabled state), the memory allocated 
> after a class object new is never freed when the class object is deleted.
> 
> So, newing and deleting several objects will fill the target memory and 
> finally bring to a target crash.
> 
> As I haven't really understood the explanation given in the Configuration 
> Tool, could someone tell me more about this option utility ?

In embedded systems, you generally don't do dynamic memory stuff. You
allocate all your memory once at startup and never free it. If the
system gets past startup, you know you will not run out of
memory. Thus delete is not needed in most systems. Providing an empty
delete function just saves on code space.

If you are doing dynamic memory stuff, you will want delete so disable
this option and be prepared for new to fail at any point in time and
know how to recover from it.

     Andrew

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]