k, first of all, python is made for working in processes and not threads, that means if you run a program in windows and stop it, all used memory is given back to the operating system.
since the xbox doesn't work with processes used memory that isn't released by python won't be given back to the xbox.
python is managing memory in a special way. it doesn't allocate memory for every object or string that is created, but instead it allocates 256k(called an area) of memory at once and keeps track of all objects, strings that are placed in it.
once you don't need an object anymore, python removes it from the 256k area but doesn't give the memory back to the system, instead when a new object is created, this object is placed in that free part of the area. python does this because it is faster then allocating / deallocating memory.
when more then 256k of memory is needed another area of 256k is created and so on.
all these area's are only released when a proces ends, and there is the problem on the xbox. memory once needed for a script in python is never given back to xbmc.
python as it exists in xbmc is created with 2 pragma section: python
python is a section which contains c / c++ code and memory that can't change, this section is about 800k.
py_rw contains variable memory that is modified when python is used, this section is about 300k.
at startup of xbmc none of these sections are loaded, python doesn't use any memory at all.
when a python script is selected in xbmc to execute. both python and py_rw are loaded into memory and python is initialized. at this moment 1200k of memory is used.
now the script is beeing executed and if it needs memory for storing stuff a new area (see above) is created.
that means that if a script uses 4 areas, a total of 4 * 256k + 1200k = 2200k of memory is used from the 64mb available on the xbox.
when the script ends, all 4 areas are cleaned so they can be used when an user selects a next script to execute( 4 * 256k of memory isn't given back to the xbox!
section python will be unloaded by xbmc and py_rw is not
at this moment, 1 mb for the areas and 300k for py_rw is in use by python.
if we select another script to run, section python is loaded again. if this scripts would need 750k of memory, python will use the existing areas for it. that means 2200k of memory is used
i didn't unload py_rw because loading it again will reset all memory. if we would unload py_rw and load it when we would need python again. python would think there where no areas created before and therefore creates new areas.
at this moment the 1 mb of areas created for the first script is lost and will never be used again (a memory leak of 1 mb!
that was the technical part, so what can you expect to come.
well there are still some small bugs to fix (including 256k areas that are never given back to xbmc).
currently i am buzy to integrate some xbmc stuff into xbmc, like a yes / no dialog and the progress dialog. for example, you could use the progress dialog when downloading a file from ftp so an user could see how long it takes before it would finish.