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 Kernel: ALLOC callbacks


NavEcos wrote:
About a month ago, I suggested making some changes to eCos that would allow:

a) a callback for every heap creation
b) a callback for every heap destroy
c) a callback for post allocation/decallocation
d) a callback for pre allocation/decallocation

This was so that you could add additional functionality, like putting in padding in the alloced memory blocks to make certain memory isn't being corrupted, and being certain that you're not allocated from heaps that have been destroyed, etc.
I should comment on your original mail better, but in brief this is reasonable, as long as it is optional!

Here are my questions:

1)

I think the changes need to be made to

services/memalloc/common/current/src/memvar.cxx
services/memalloc/common/current/src/memfixed.cxx

And the definitions of the classes Cyg_Mempool_Fixed and Cyg_Mempool_Variable

And that should cover doug lea's memory allocation as well. Is this correct or am I missing other classes that need to be modified
No, it wouldn't cover dlmalloc. Just the bog standard fixed and variable block allocators. You'd need to edit dlmalloc.cxx

2)

It appears that heaps are being created before cyg_user_start. I want to install the callbacks into the system before any heaps are created - where should I install the callbacks?
They are created by global constructors. "Simply" ( :-) ) create a global constructor of higher priority than any constructor creating a heap.

3)

I would like to make the callbacks global that that installing the callbacks will do it for all heaps, not just an individual heap. Are there any objections to this?
Configurability is the key. With configurability you could maybe do either, both[1] or neither.

Jifl
[1] Use a specific callback if called, or else the global one
--
eCosCentric http://www.eCosCentric.com/ <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine


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