16 |
a.demoMode = 1 |
a.demoMode = 1 |
17 |
|
|
18 |
class ViewScene: |
class ViewScene: |
|
def __init__(self): |
|
|
self.x = 0 |
|
|
self.y = 0 |
|
|
self.text = ['M','e','m','o','r','y','L','e','a','k','!'] |
|
|
|
|
19 |
def scene(self, vs): |
def scene(self, vs): |
20 |
size = vs.getSize() |
size = vs.getSize() |
21 |
|
|
23 |
self.bgcolor = (0.5, 0.4, 0.7) |
self.bgcolor = (0.5, 0.4, 0.7) |
24 |
putnoc(vs, background(self.bgcolor)) |
putnoc(vs, background(self.bgcolor)) |
25 |
|
|
|
colchars = 60 |
|
|
tscale = min(size.width*1.0, size.height*4.0/3) / colchars |
|
|
|
|
|
|
|
26 |
# Build 500 coordsys ;) |
# Build 500 coordsys ;) |
27 |
cs_a = vs.coords.affineCoordsys(0, 10, self.x,self.y, tscale, 0, 0, tscale) |
cs_a = vs.coords.affineCoordsys(0, 10, 1,1, 1, 0, 0, 1) |
28 |
for i in range(0,1000): |
for i in range(0,900): |
29 |
cs_a = vs.translateCS(cs_a, "asdf"+str(i), 0,0,0) |
cs_a = vs.translateCS(cs_a, "asdf"+str(i), 0,0,0) |
30 |
|
|
31 |
|
# The next line causes the memory leak!!!!!!!!!! |
32 |
vs.matcher.add(cs_a, "A") |
vs.matcher.add(cs_a, "A") |
|
putText(vs, cs_a, self.text[0], color=(0,0,0), h=4, y = 3) |
|
|
|
|
|
self.y = self.y+2 |
|
|
if self.y == 40: |
|
|
self.y = 0 |
|
|
rotatelist(self.text) |
|
|
self.x = self.x + 50 |
|
|
if self.text[0] == 'M': |
|
|
self.x = 0 |
|
|
|
|
|
# Collect garbage |
|
|
System.gc() |
|
33 |
|
|
34 |
|
System.gc() |
35 |
# And again... |
# And again... |
36 |
|
GL.freeQueue() |
37 |
AbstractUpdateManager.chg() |
AbstractUpdateManager.chg() |
38 |
|
|
39 |
currentScene = ViewScene() |
currentScene = ViewScene() |