[ECOS] Inside eCos : the new operator

Bart Veer bartv@redhat.com
Tue Aug 22 03:15:00 GMT 2000


>>>>> "Fabrice" == Fabrice Gautier <Fabrice_Gautier@sdesigns.com> writes:

    >> -----Original Message-----
    >> From: Bart Veer [ mailto:bartv@redhat.com ]
    >> Subject: Re: [ECOS] Inside eCos : the new operator
    >> 
    >> The invocation of the new() operator involves C++ 
    >> placement syntax,
    >> which is just part of the standard language.
    >> 
    >> If the code looks something like:
    >> 
    >> Object* ptr = new Object(arg1, arg2);
    >> 
    >> then this invokes the default new operator, which will perform dynamic
    >> memory allocation - I suspect it would end up calling malloc(), but
    >> have not checked this.

    Fabrice> In this case, I suspect this will fail if the libc is not
    Fabrice> compiled as a part of eCos. In another message you
    Fabrice> mentionned the fact that eCos was not written with
    Fabrice> dynamic allocation in mind so I wonder how it handle a
    Fabrice> "dynamic" new operator. Does/Can it uses memory pools?

Internally the kernel does not use this default invocation of the new
operator, so it never gets linked in and there is never any need for
malloc().

If application code starts to use the default new operator then you
would have to ensure that a suitable one is available. This could mean
writing your own, or providing your own malloc(), or enabling the C
library package.

Bart Veer // eCos net maintainer


More information about the Ecos-discuss mailing list