|
From: James W. <ja...@fr...> - 2007-01-30 18:14:04
|
Roger Holmes wrote:
> Could someone see if they agree with what appears to be
> a memory leak in E3AttributeSet_Inherit. I have a provisional
> fix which is:
>
> In this section of code, change the last but one line
>
>
> // Process the child
> if ( qd3dStatus == kQ3Success )
> {
> // Copy the mask and attributes directly
> resultSet->setData.theMask = childSet->setData.theMask ;
> resultSet->setData.attributes = childSet->setData.attributes ;
> if ( resultSet->setData.attributes.surfaceShader != NULL )
> resultSet->setData.attributes.surfaceShader =
> Q3Shared_GetReference ( childSet->setData.attributes.surfaceShader ) ;
>
>
> to read:
>
> if ( resultSet->setData.attributes.surfaceShader != NULL && result !
> = child )
>
>
> When E3AttributeSet_Inherit gets called with child == result, the
> reference count of surface
> shaders gets incremented incorrectly, which loses huge amounts of
> memory with even
> modest sized textures if you call this routine a lot, which I do when
> doing the CSG
> calculations for windows and doors within walls, which is now done
> for almost every time
> redraw.
>
> If you agree with the change, could you check it in, or remind me how
> to do it
> as I have not done a Quesa check in for some time and I've forgotten
> how.
I didn't know that Q3AttributeSet_Inherit allowed the result to be the
same as the parent or child. It's not documented that way.
It looks to me like that whole section labeled "Process the child" can
be skipped if result == child. Am I wrong?
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
|