[Bf-python] Memory issue with Mathutils

Michael Schardt M.Schardt at web.de
Tue Nov 22 16:50:12 CET 2005


Hello all!

I wrote an email to Campbell Barton already about this issue - but i don't know if will take care...
Would you please confirm my "experiment":

There seems to be a memory leak in Mathutils: The problem comes up when multiplicating 
scalar * vector,
scalar * matrix,
vector * scalar,
matrix * scalar,
vector * matrix,
and matrix * vector

I tested with latest CVS version from testing builds-forum and 2.40 alpha 2 under XP
Simple and "dirty" test: open taskmanager and watch the memory go up, up, up, up,... whenever running this py-script

###########
import Blender; from Blender import Mathutils

v = Mathutils.Vector(1.0, 2.0, 3.0, 4.0)
m = Mathutils.Matrix([1.0, 0.0, 0.0, 0.0],
                     [0.0, 1.0, 0.0, 0.0],
                     [0.0, 0.0, 1.0, 0.0],
                     [0.0, 0.0, 0.0, 1.0])

for i in xrange(100000):
  n = 5.0 * v # +6MB
#  n = 5.0 * m # +12MB
#  n = v * 5.0 # +6MB
#  n = m * 5.0 # +12MB
#  n = v * m # +6MB
#  n = m * v # +12MB

###########

On my computer memory is never freed again (at some point windows even starts swapping to disk)
This becomes really a problem when using Mathutils within spacehandlers...

Michael Schardt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20051122/3d36c658/attachment.html>


More information about the Bf-python mailing list