Am 08.06.2010 14:57, schrieb Delyan Kratunov:
Right, sorry about the delay.
Current status: I'm .. stuck, for lack of a better word.
Deheapifying flite has proven almost impossible. Long story short, I
traced every malloc call and have a pretty good idea which ones can be
grouped together and moved to the stack (at the cost of some wasted
memory). However, the majority of the malloc calls cannot be removed.
I was convinced it was a peculiarity of the implementation but it
looks like it's a fundamental requirement of the engine. Not only will
the lack of malloc break encapsulation (a HUGE number of extern
globals would have to be introduced) but it would actually require
much more memory than the heap version. So the question here is
whether malloc in core (even as a loadable component) is an absolute
no-do. I'm not going to try and hide the ugly truth - the memory
fragmentation is MASSIVE, even with something like tlsf.
Unfortunately it's not only a NODO, it's simply not doable properly.
tlsf is the best you can get on the devices Rockbox runs on. Like you
said, fragmentation is massive even with tlsf, and you cannot help it
without proper hardware support, e.g. MMU (on some targets) and memory
paging is not available.
This is how I understood the issue, correct me if I'm wrong.
It's unfortunate to hear that you're stuck. but I hope you don't give up
and find a way to do it.
Best regards.