This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
malloc vs. new
- From: Scott Dattalo <scott at dattalo dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Fri, 21 Jun 2002 19:18:18 -0700 (PDT)
- Subject: [ECOS] malloc vs. new
In a project I'm porting to eCos there is some C++ code. Consequently,
there are several new() calls for creating new objects. Unfortunately,
calls to new() hang. Specifically, the kernel is unable to allocate memory
and throws an exception. This switches control to the exception thread and
control is never released...
Calls to malloc, OTOH, work just fine.
I've sifted through the documentation and the best I could come up with is
this snippet:
#define MEMORY_BUFFER 0x1000
char StaticMemoryBuffer[MEMORY_BUFFER];
...
cyg_handle_t mempool;
cyg_mempool_var mempool_obj;
cyg_mempool_var_create(StaticMemoryBuffer, MEMORY_BUFFER, &mempool,
&mempool_obj);
This still fails. How does one provide a memory allocation buffer for
new()?
Scott
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss