This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: New memory allocation debug feature
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: Andrew Lunn <andrew at lunn dot ch>
- Cc: ?yvind Harboe <oyvind dot harboe at zylin dot com>,ecos-discuss at sources dot redhat dot com
- Date: 17 Jun 2004 14:01:19 +0100
- Subject: Re: [ECOS] New memory allocation debug feature
- References: <1087469710.31564.11.camel@famine><20040617121021.GB20791@lunn.ch>
Andrew Lunn <andrew@lunn.ch> writes:
> On Thu, Jun 17, 2004 at 12:55:11PM +0200, ?yvind Harboe wrote:
> > Comments?
>
> I would prefer the function to use the cyg_ prefix so it does not
> polute the namespace.
To underline this, the naming convention for eCos is to separate words
in a name with underscores, not to use capitalization. Names should
also contain the subsystem that they belong to and be descriptive of
what they do. I think that the function should probably also have some
arguments indicating, at least, the size of allocation that failed and
the memory pool that has been exhausted.
So I would like to see something more like:
__externC void cyg_memalloc_alloc_fail( CYG_ADDRESS pool, cyg_uint32 size );
In theory this whole thing should be better integrated into the C++
classes that implement the memory allocators, but having an external
function to call is an acceptable first step.
>
> You also need to provide an implementation in libtarget.a for when the
> application does not have such a function. eg all the test programs
> will not provide this function, so will fail to link when your new
> option is enabled. So please add a week function which does nothing,
> or maybe throws an CYG_FAIL().
s/week/weak/ :-)
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss