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]

Re: Problems allocating memory with C++ new operator on eCos 1.3.1


On Fri, Nov 02, 2001 at 10:55:46AM -0500, Chris Sekula wrote:
> I have been having some problems allocating memory with the C++ new
> operator. We are using the Cirrus Logic EP7312 chip and eCos 1.3.1. We
> have used the patch provided by Cirrus Logic so that we can enable the
> 7212 template to work on the 7312. Our board has 16 Megs of RAM.
>  
> I launched a main thread with a stack size of 5000 bytes. In this
> thread, when I try to allocate more than 16356 bytes, my program hangs.
> The test program works with allocations less than this amount. I played
> with a few different stack sizes as well, keeping the dynamic allocation
> at 16356 bytes. The allocation doesn't work when a stack size of 7500
> bytes(or more) or 2000 bytes (or less) is used.
>  
> Does eCos put a narrow limit on the size of the heap? How can I get
> around this problem?

Its a long time since i used 1.3.1 so you should double check
everything i say!

The stack size should not have any affect on the heap. I think you are
seeing a side affect here. When its going wrong its corrupting your
stack. It only hits something vital when your stack is < 2000 or >
7500. 

Are you checking the return from new. Does it fail when you ask for
more than 16K or are you just blindly using the return value which may
be a null pointer and so you then corrupt something in low memory.....

1.3.1 does not have the dynamic heap code if i remember correctly. Its
implemented using a variable size memory pool. You can change the size
of the pool using the CDL in ecos.ecc. I have a vague recollection the
default is 16K! What size are you using?

     Andrew


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