This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Problems allocating memory in main()
- To: Andreas B?rgel <ab at genologic dot de>
- Subject: Re: [ECOS] Problems allocating memory in main()
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- Date: Mon, 9 Oct 2000 12:15:19 +0200
- Cc: eCos Disuss <ecos-discuss at sourceware dot cygnus dot com>
- References: <39E18D6B.584D1547@genologic.de>
> //void cyg_user_start ( void) {
> int main () {
> Cyg_Thread* lThread0;
> Cyg_Thread* lThread1;
> char* lPing = "ping";
> char* lPong = "pong";
> char lStack0 [4096];
> char lStack1 [4096]; // uncomment this line and it works
Think about where these two stacks are going? They are going on the
stack of main. eCos calls main with a small stack, probably 4K. You
are going off the end of the stack allocated to main and corrupting
what ever follows. You want to put the stacks somewhere else.
Andrew