Hi all,
It seems that calling Polygon.exterior generates objects that are not
collectable even by gc.collect(). Attached script reproduces the issue.
Thanks,
Jaakko
from shapely.geometry import Polygon
import random
import gc
from pprint import pprint
random.seed()
randint = random.randint
gc.enable()
gc.set_debug(gc.DEBUG_SAVEALL)
#
# For some reason, if iterations == 1, no uncollectable
# garbage is generated.
iterations = 2
#
# Let's build some dummy polygons and call their
# exterior property.
for i in range(0, iterations):
points = []
x0 = x = float(randint(-100, 100))
y0 = y = float(randint(-100, 100))
points.append((x, y))
for n in range(0, randint(2, 10)):
x += float(randint(0, 100))
y += float(randint(0, 100))
points.append((x, y))
points.append((x0, y))
points.append((x0, y0))
poly = Polygon(points)
poly.exterior
gc.collect()
pprint(gc.garbage)
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community