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]
Other format: [Raw text]

Re: eCos + goAhead probelm



I only change one line in the function balloc() in balloc.c


goAhead version: 218
orignal file (line 259 ~ 263)==>
           bp = (bType*) malloc(memSize);
           if (bp == NULL) {
               traceRaw(T("B: malloc failed\n"));
               return NULL;
           }

modified ==>
           bp = (bType*) malloc(memSize + 64);
           if (bp == NULL) {
               traceRaw(T("B: malloc failed\n"));
               return NULL;
           }

goAhead pre-allocate a lot of memory(about 60KB) at bopen() to build it's own memory pool.
When it need some memory, it will get it from it's own memory pool first, if the memory pool is empty,
then it call malloc() to get memory from eCos.
So, the balloc() will check it's own memory pool first. if empty, then call malloc().
Because you increase the pool size of goAhead. So the balloc() never call malloc() to get new memory.


I try to put lots of debug message to trace the bug. Then I found eCos 's memory pool information is overwirtten by goAhead.
So, I think the problem is goAhead use balloc() to get some memory, and the pre-allocate memory pool is already empty.
Then it call malloc() to get new memory from eCos.
After this, goAhead put too much data(more than the size it allocated) to this buffer, cause eCos 's memory pool information crashed.


Now, I don't have time to found real murderer in goAhead.
But hope it can give you a direction to solve your problem.

Hao


After some more tests, I've got a stable web server when I call bopen()
with a bufsize of 1.25M !
(1M is still not enough - I could bring it to crash after a massive set
of requests... )
Does it make sense?

What is the malloc size you're using for balloc's malloc() to solve the
out of memory problem?

Thanks,
-- Amir

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org]On Behalf Of Hao
Sent: Tuesday, August 17, 2004 6:41 AM
To: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] eCos + goAhead probelm



Recently, I modify balloc() in balloc.c of goAhead.
I try to increase 64bytes at the line of malloc() . And the problem of out of memory disappeared.
So , I think it's not the probelm caused by eCos.
I think it's caused by goAhead somewhere that call balloc() and use wrong size.


Now, in my target, goAhead still unstable just like you say. Then I use very simple web page instead of default web page(home.asp).
It still unstable, but not crashed.
But it can work very fine when I use 'lynx' instead of other browser(IE, mozilla..).
I don't know what's the difference of behavior between lynx and other browser (IE,mozilla).


Hope this information can help you something.

Hao






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


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