[En-Nut-Discussion] Killing Processes and malloc

Moritz Struebe morty at gmx.net
Thu Mar 13 12:15:49 CET 2008


Hi there,

I developing a possibility to load applications during runtime. If I 
want to delete or replace an application, I have to shut it down before. 
I'm thinking of signaling or adding a flag to the NUTTHREADINFO. One 
serious problem I came up with is the stupid/lazy/whatever developer who 
forgets to free his mem. While this isn't such a serious problem in 
normal situations, where you normally don't stop threads that often, 
this might quickly become a problem replacing the app several times. 
Also it might be, that the process does not end itself - due to a 
programming error or whatever. In that case I have to kill the process 
and somehow free the mem.

To solve this I was thinking of adding a allocated mem list for each 
process. This does bring a bit of overhead but I think is't a worth that 
price. The root of the list would be in NUTTHREADINFO. If a process gets 
kill you just have to work along this list and free the mem. On an atmel 
this will cost you 2 Bytes per process 2,5 Bytes per alloc. (I'd align 
the blocks to a word and then use 16bit pointers.) (BTW: It should be 
"long word" in heap.c:183)

Of course I'd implement this with ifdefs. Is there any interest in 
adding this to the trunk. Or has anyone got a better idea?

Cheers
Morty




More information about the En-Nut-Discussion mailing list