Rockbox mail archiveSubject: idea to rework the WPS memory management
idea to rework the WPS memory management
From: Jonathan Gordon <jdgordy_at_gmail.com>
Date: Fri, 26 Dec 2008 15:47:26 +1100
I've been working on a new WPS tag and one of the problems I've found
with the current system is if the tag needs to store more info than 1
short it needs to create a new struct and put an array of them into
the global wps_data struct (along with a counter of how many are used)
which means that everyone one of these has an artificial limit and
potentially wastes RAM if your WPS doesn't use it. (quick examples...
max of: 52 images, 3 progress bars, 24 viewports, X lines (based on
lcd height), etc..)
My idea is this:
use buff_alloc() (or statically sized array) to get a single global
wps buffer (or maybe 1 for each screen), add a pointer to this and the
free bytes count into the wps_data struct, then remove almost all of
the current items there (all the arrays this would replace.) The token
struct would then be changed so that the "value" union has a void*
element which if needed would point into the global wps buffer.
This might sound like a call for malloc, but it isnt.. just like
buff_alloc, there is no way to free up part of the buffer (its all or
The goal here would be to get better use out of the allocated WPS RAM
(especially if we make it user defineable so people with boring WPS's
could waste much less ram than a heavy bmp/AA one), as well as
hopefully making wps_data easier to work with.
I havnt started working on it because I dont know the WPS code well
enough to know if this is feasable straight away, so any comments
would be great.
Received on 2008-12-26