thcmedia / papervision3d

Automatically exported from code.google.com/p/papervision3d
0 stars 0 forks source link

Important memory leak #100

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. create a plane ( or any object ) on a 'enterFrame' basis
2. Try to remove it by all means or don't even assign it a permanent 
reference
3. watch the flash player memory print grow steadily when running the app.

What version of the product are you using? On what operating system?
rev723 on windows XP

Please provide any additional information below.

That should not increase memory but it does :
public class Main extends Sprite
{
     private var material:MaterialObject3D;

     public function Main()
     {
            material = new WireframeMaterial();
            this.addEventListener ( Event.ENTER_FRAME, viewPortEnterFrame )
     }

     public function viewPortEnterFrame ( e:Event )
     {
            var thing = new Plane ( material , 20, 20, 4, 4 )
     }

}

But that..
 public function viewPortEnterFrame ( e:Event )
 {
      var thing = new Plane ( material , 20, 20, 4, 4 )
      material.unregisterObject ( thing )
 }
... does not increase memory. It shouldn't since material.objects modified 
by unregisterObject is a Dictionnary with weak reference... but it does.

I work on an app that create and destroy dozens of displayObject3D per 
minutes. The memory leak is so bad i can't hope to make it work more than 
30 to 60 minutes... Even the unregistering of objects on material don't 
solve my problem. I can send the whole code to anyone willing to see 
what's wrong (just have to comment it in english first).

Original issue reported on code.google.com by Krob...@gmail.com on 11 Sep 2008 at 8:46

GoogleCodeExporter commented 8 years ago
I investigated further into the memory leak problem and came up with something 
interesting :

Test 1 : on EnterFrame basis
1 - add plane to a scene3D (addChild)
2 - remove plane (removeChild)
3 - destroy plane (unregister plane at it's material, nullify geometry and 
all...)
4 - render the scene3D
==> No memory leak

Test 2 : on EnterFrame basis
1 - add plane to a scene3D (addChild)
2 - render the scene3D
3 - remove plane (removeChild)
4 - destroy plane (unregister plane at it's material, nullify geometry and 
all...)
==> memory leak with intensity depending on the mesh tessellation and not the 
material size

Conclusion : The renderer create somewhere a copy of the geometry of new 
objects 
which is completely independant of the initial displayObject reference (since 
it has 
been nullified).

I worked hard to find where but i lack the debugging tool to spot where the 
memory 
goes. Sadly for me it means, Papervision is useless till this issue is solved. 
I may 
continue my search in my spare time though...

Original comment by Krob...@gmail.com on 14 Sep 2008 at 11:21

GoogleCodeExporter commented 8 years ago
Additional information :

The memory leak occurs when the object has a bitmapMaterial and not with a 
WireframeMaterial or ColorMaterial.

There is a memory leak though with Wireframe and ColorMaterial if you dont 
unregister object after removal from the displayList

Original comment by Krob...@gmail.com on 14 Sep 2008 at 5:22

GoogleCodeExporter commented 8 years ago
Fixed

Original comment by r.hauw...@gmail.com on 17 Nov 2008 at 12:07