I might be remembering incorrectly, but maybe this is expected and
documented behavior. (It certainly is if you pass the Label constructor an
explicit Batch.) I think the Label is supposed to continue to exist (taking
up room in vertex lists in a Batch) until explicitly destroyed (with its
delete or remove method, I forget which), even though it does not get drawn
unless you call the draw method (on it or its batch).

- Bruce Smith

On Tue, Mar 23, 2010 at 9:39 AM, Remy Blank <[email protected]> wrote:

> The following program leaks about 300 KB per second on my machine
> (Windows XP, Python 2.6.5, pyglet 1.1.4, NVIDIA Quadro FX 360M (but I
> can observe the same on an Intel 855GME)):
>
> --8<-------------------------------------------------------------
> import pyglet
>
> w = pyglet.window.Window()
>
> while not w.has_exit:
>    w.dispatch_events()
>    w.clear()
>    l = pyglet.text.Label("abc", font_size=w.height,
>                          x=w.width/2, y=w.height/2,
>                          anchor_x="center", anchor_y="center")
>    l.draw()
>    w.flip()
>    pyglet.clock.tick()
> --8<-------------------------------------------------------------
>
> I know I shouldn't be creating labels in the loop, but this test case
> was extracted from a larger application that runs for several hours, and
> creates a number of labels during its execution. Currently, the
> application dies after 2 hours from memory exhaustion, when it should
> run for 8 hours straight.
>
> I have tried peeking into the implementation of Label, TextLayout,
> _GlyphBox and Batch, but I have to admit that I got lost along the way.
>
> I am going to try to run the test with a Python memory analyzer, to try
> and find what kind of objects take up memory. In the meantime, can
> anyone confirm the issue? Any ideas what could be the cause? Any
> workarounds that I could try?
>
> Thanks.
> -- Remy
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" 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/pyglet-users?hl=en.

Reply via email to