[ECOS] malloc initialization problem

sensitron medical sensitronnet@yahoo.com
Tue Apr 1 21:17:00 GMT 2003


My malloc does not fail if the size of the heap is
exceeded; I can malloc indefinitely. I traced this to
the constructor (see below), which is where I believe
the heap size is set (is this true?). Here's the
constructor for memvar.cxx instrumented with two
globals (caSize and caBase) that I can examine with an
emulator after the constructor executes:

//
-------------------------------------------------------------------------
// Constructor: gives the base and size of the arena
in which memory is
// to be carved out
cyg_int32 caSize = 0;
cyg_uint8 *caBase = 0;

Cyg_Mempool_Variable::Cyg_Mempool_Variable(
    cyg_uint8 *base,
    cyg_int32 size,
    cyg_int32 alignment)
    : mypool( base, size, (CYG_ADDRWORD)alignment )
{
  caSize = size;
  caBase = base;
}

caSize is set to 33907992. I have no idea where it is
getting this number from since the size of the heap is
16384.

I say that the size of the heap is 16384 because I
have:

#define CYGNUM_MEMALLOC_FALLBACK_MALLOC_POOL_SIZE
16384

I have tried both the simple variable allocator and
Doug Lea's allocator. They both have bogus sizes,
although they are not the same value.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com

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



More information about the Ecos-discuss mailing list