Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in RenderableListItemPool #63

Open
pigiuz opened this issue Jun 23, 2011 · 0 comments
Open

Memory leak in RenderableListItemPool #63

pigiuz opened this issue Jun 23, 2011 · 0 comments

Comments

@pigiuz
Copy link

pigiuz commented Jun 23, 2011

I experienced a memory leak in the rendering process. After a render call renderables still were refrenced by RenderableListItem s and RenderableListItem s still had references to the next.

I fixed the leak by
adding a function resetIndex to RenderableListItemPool,
editing the function freeAll in RenderableListItemPool,
and changing the calls EntityCollector performs to _renderableListItemPool instance.

Here's the changes:

RenderableListItemPool.as:

ADDED
public function resetIndex():void
{
_index = 0;
}

EDITED
public function freeAll() : void
{
var item:RenderableListItem;
while(_index-->0){
item = _pool[_index];
item.renderable = null;
item.next = null;
}
}

EntityCollector.as

[EDITED]
public function clear() : void
{
_numTriangles = _numMouseEnableds = 0;
_blendedRenderableHead = null;
_opaqueRenderableHead = null;
_renderableListItemPool.resetIndex(); // << call resetIndex instead of freeAll
if (_numLights > 0) _lights.length = _numLights = 0;
}

[EDITED]
public function cleanUp() : void
{
if (_numEntities > 0) {
for (var i : uint = 0; i < _numEntities; ++i)
_entities[i].popModelViewProjection();
_entities.length = _numEntities = 0;
_renderableListItemPool.freeAll(); // << added!
}
}

ciao,
pigiuz

MichaelPlank pushed a commit to Pro3Games/away3d-core-broomstick that referenced this issue Sep 20, 2011
…mapping near plane, fixed unwanted triggers of mouseOut and mouseOver events. Closes away3d#63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant