[Bf-python] Problem with memory...

Manuel manuelbastioni at tin.it
Sun Jul 17 10:22:59 CEST 2005


Joseph Eagar wrote:

> There's a few problems with your code, actually. . .
> 
> First, you're making a NMesh wrapper twice, and not updating it (NMesh 
> is a "intermediary" or "thick" wrapper, changes to it don't affect the 
> mesh unless you call .update()).  Every time you call .getData(), a new 
> NMesh is created, and unless you already called .update(), all changed 
> you made will be lost.

Thanks.
I've done some changes. Now the code seem to work, but about 2-3% of 
memory is not cleared. Example:
Before create 1000 hairs: 160 MB
After create 1000 hairs: 170 MB
After delete the hairs: 163 MB


The code now is:

def deleteHairs():
     global objHairs
     sc = Scene.getCurrent()
     for ob in objHairs:
         obData = ob.getData()
         obData.verts=[]
         obData.faces=[]
         obData.update()
         sc.unlink(ob)
     sc.update(0)
     objHairs = []


Thanks!

              Manuel






More information about the Bf-python mailing list