[ECOS] Problem of sizes for memory pools

Matthieu.GIRARDIN@fr.thalesgroup.com Matthieu.GIRARDIN@fr.thalesgroup.com
Mon Jun 30 07:56:00 GMT 2003


Hi !

First thanks to Jonathan and Reji for their answers to my previous post.

Just another two little questions about memory pools.

 * I must allocate (malloc) enough memory before to use
cyg_mempool_fix_create() because (the creation of partitions is done in an
initialisation step in a root thread but) I can't know by advance sizes of
theses partitions. So I can't use a static definition... is it correct ? is
it possible ? I work on eCos to do a layer for a application I don't know :
so I don't know sizes the application will want... Is it clear ? ask me if
not.

* Now, because I must allocate (equivalent to "static char
mempoolspace[size]"), what's the link between the size in mempoolspace[size]
and the block size of cyg_mempool_fix_create() ?
I have as parametres : a nombre of blocks, a fixed size of blocks.
I think, tell me if I'm right, I must allocate a tab of char with nb_blocks
* size_block elements.

For example : 
mempoolspace = (void *) malloc (nb_blocks * size_block * sizeof(char))
or the equivalent I can't use : 
static char mempoolspace[nb_blocks * size_blocks];

Am I right ? 
If it's correct, I think too my third parametre of cyg_mempool_fix_create is
size_block ?
I think definitly it's false so can someone help me ?

Thanks,
Best regards.

Matthieu 

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



More information about the Ecos-discuss mailing list