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: memory pools


On Mon, Feb 18, 2002 at 10:02:28AM +0100, Tom Coremans wrote:
> 
> Hi ,
> 
> To create a memory pool you have to give a pointer to the base of memory
> to use for the pool. What should that be on the linux synthetic
> target??? How can I know where there is a block of memory that I can
> use??

Same way as you do on any target. Declare a static or global array of
bytes and use that. The compiler will put it into the bss and
everything will be happy.

static char sbuf_mem[(NUM_SBUFS+2)*(sizeof(struct sbuf))];
cyg_handle_t sbuf_mem_handle;
static cyg_mempool_fix fix;
 
cyg_mempool_info info;
 
 
void sbuf_init() {
  
  cyg_mempool_fix_create(sbuf_mem,
                         (NUM_SBUFS+2)*(sizeof(struct sbuf)),
                         sizeof(struct sbuf),
                         &sbuf_mem_handle,
                         &fix);
}
       
How are you doing it on 'real' targets? Be careful of the heap. Any
spare memory not explicitly allocated to something is eaten up by the
dynamic heap. 

        Andrew

-- 
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]