Rockbox mail archive
Subject: possible fix for skin buffer issues
possible fix for skin buffer issues
Braindump for someone to pick up to fix the skin buffer memory
The "problem" is that The vast majority of the skin buffers static
allocation goes to the struct skin_element which is allocted for every
single item in the skin file. Every line, tag, subline, comment, etc.
on e200 this comes out to 41KB (going from memory). The next biggest
allocation is struct skin_token, which is 20x smaller in total than
So obviously there is no point doing anything except move skin_element
This is *problematic* because they are used, well everywhere.
My braindump fix is this:
1) give the lib a callback which will allocated 1000 skin_element
structs in a block (we obviously dont want 600 allocations for this)
2) in skin_alloc_element() allocate from the above array instead of
the skin_buffer (when it is full allocate another 1000 or so)
3) in skin_render_viewport() (and a few other places) lock all those handles
4) in the move callback, walk the entire skin tree (this means every
tree loaded) and update each pointer. This is going to be slow and
crap, but hopefully not done often.
I *think* those items are only used when traversing the tree so it is
possible the pointer updating could even be done delayed (so store the
diff somewhere and update the first time it is traversed after the
move - Though this could be very dangerous, actually yeah, dont do
this. hidden viewports are ignored at render time).
I'm not sure what the alternatives are, this is a pretty nasty
solution. Hopefully someone comes up with a better one (or implements
this as I don't particularly have interest in doing it right now, but
thought it would be good to explain the issue and a solution.)
Received on 2011-10-09
Page was last modified "Jan 10 2012" The Rockbox Crew