help: ram usage problem
#1
i wrote this short testing script. it works good and shows this slideshow endlessly.

Code:
import xbmcgui, threading, os, time

class test(xbmcgui.WindowDialog):
  def __init__(self):
    self.pic=xbmcgui.ControlImage(0,0,1200,800,"")
    self.addControl(self.pic)
    self.restart()
    
  def restart(self):
    self.Thread=threading.Thread(group=None,target=self.loop,name=None,args=(),kwargs={})
    self.Thread.start()
    
  def loop(self):
    self.imageNames=[]
    for item in os.listdir("/home/gigi/Bilder"):
      if item[-4:] == ".jpg" or item[-4:] == ".png":
        self.imageNames.append(item)
    
    for i in range(len(self.imageNames)):
      self.pic.setImage(os.path.join("special://home", "..", "Bilder", self.imageNames[i]))
      time.sleep(5)
    self.restart()
    
mydisplay=test()
mydisplay.doModal()
del mydisplay

the problem with it is that the ram space xbmc uses gets bigger and bigger... endlessly. I'm using ubuntu hardy 8.04.

EDIT: Updated Script Code
Reply
#2
The image is probably not being free'd. Check the python interfaces - I think it's in window.cpp, somewhere under xbmc/lib/libPython
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Why not create a single ControlImage and change the image every 5 seconds using ControlImage.setImage()?
See http://xbmc.sourceforge.net/python-docs/...ntrolImage

Also might be a good idea to use os.path.join and one of the special paths instead of concatenating the paths yourself, as that might not work on anything else but Unixes:

Code:
os.path.join("special://home", "Bilder", self.imageNames[i])

See
http://www.xbmc.org/wiki/?title=Special_protocol
http://python.org/doc/2.4/lib/module-os.path.html
Reply
#4
@jmarshall: I'm sorry but I'm not able to handle with c++. it would be great if you could give me instructions how to solve my problem with c++. (if it's even possible)

@Dan Dare: I tried it with .setImage() but the ram usage problem is the same. thank you for the idea with specialpaths/path.join. see updated script code above.
Reply
#5
Is it just me or are you starting too many threads? To me it looks like its going __init__ > restart() > new thread > loop > restart > new thread > etc...

If you want the slideshow to run indefinite, why not wrap the the for() with a while (True) loop?

Btw, why are you using threads? Is it because you plan to add some Cancel button to stop the slideshow or something like that?
Reply
#6
yeah you're right. one thread would be enough. this slideshow will be just a small part of a screen design. it must be manageable by an other module, so I need threading to start and stop several modules at the same time.
Reply
#7
Good job - keep a hold of them threads or they're going to crash very quickly on Xboxes :-)
Reply

Logout Mark Read Team Forum Stats Members Help
help: ram usage problem0