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]

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


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