Is there a good way to display 10 000 images ?
Not at the same time of course.
But one user will see always 10 to 20 images, and they will change
every 1s, and be picked from a database of 10 000.

On Apr 24, 2:03 pm, claudio canepa <[email protected]> wrote:
> On Tue, Apr 24, 2012 at 5:17 AM, Philippe <[email protected]> wrote:
> > Hi,
>
> > In a Layer, I draw 9 sprites every second.
> > Every second, I remove the 9 previous sprites.
>
> > ############################################
> > class Test(Layer):
>
> >    is_event_handler = True
>
> >    def __init__(self):
> >        super(Test, self ).__init__()
> >        self.sprites = []
>
> >    def on_enter(self):
> >        super(Test, self).on_enter()
> >        self.schedule_interval(self.update_map, 1.)
>
> >    def update_map(self, dt):
> >        for s in self.sprites:
> >            self.remove(s)
> >            del(s)
> >        self.sprites = []
> >        for i in range(9):
> >            im = 'im_z{0}_x{1}.png'.format(i, randint(0, 1000))
> >            s = Sprite(im)
> >            self.sprites.append(s)
> >            self.add(s)
> > ############################################
>
> > every second, I remove the sprites and delete them, with:
> >            self.remove(s)
> >            del(s)
>
> > however, the memory rises continuously.
> > If I remove that "self.schedule_interval(self.update_map, 1.)" -> no
> > leak.
>
> > Any idea ?
> > thanks !
>
> Maybe is related to this
>  http://code.google.com/p/pyglet/issues/detail?id=552
>
> I don't know what is your use case, but it is never a good idea to heavily
> delete and recreate sprites (Yes, I known your code is a bugdemo, but your
> real code must be deleting and creating something also, otherwise you had
> not noticed the issue)
>
> It is better to preload the images and then change the image member of
> sprite.
>
> An animation example for this can be seen 
> athttp://code.google.com/p/aiamsori/source/browse/trunk/gamelib/gamecas...
>
> claudio
>
> --

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en.

Reply via email to