Memory leak found

dotorimook
2013-10-18
2013-10-24
  • dotorimook

    dotorimook - 2013-10-18

    I found memory leak in the call stack:

    IFXCore.dll!IFXAllocate(unsigned __int64 byteCount=64)  줄 56    C++
    IFXCore.dll!operator new(unsigned __int64 byteCount=64)  줄 142 + 0xa 바이트    C++
    IFXCore.dll!IFXArray<IFXMatrix4x4>::Construct(unsigned int index=0)  줄 300 + 0xa 바이트    C++
    IFXCore.dll!IFXCoreArray::ResizeToAtLeast(unsigned int required=1)  줄 69 + 0x14 바이트 C++
    IFXCore.dll!IFXArray<IFXMatrix4x4>::CreateNewElement()  줄 252   C++
    IFXCore.dll!CIFXNode::AddParent(IFXNode * pNewParentNode=0x0000000022135260)  줄 1701 + 0x14 바이트 C++
    

    In CIFXNode::AddParent,

            if (numelements > 0) 
            {
                IFXMatrix4x4& NewLocal = m_Local.CreateNewElement();
                NewLocal.MakeIdentity();
                free(&NewLocal);
            }
    
            IFXMatrix4x4& NewWorld = m_World.CreateNewElement();
            NewWorld.MakeIdentity();
    

    this block was found.

    I added free(&NewWorld); at the end of the block, but it was crashed while deallocation process.

    not only this case, there are so many memory leak situations.

    How can I solve memory leak problem?

    Thanks.

     
  • dotorimook

    dotorimook - 2013-10-18

    the U3D version is 1.3.4

     
  • Michail Vidiassov

    Please, tell us what the problem is.
    (I guess the moderators are long gone, so you'd better restate your message so to avoid premoderation.)

     
  • dotorimook

    dotorimook - 2013-10-22

    The memory leak found while in CIFXNode::AddParent(IFXNode* pNewParentNode)

    IFXMatrix4x4& NewWorld = m_World.CreateNewElement();

    So I added delete at the end of function, then sometimes it worked, and sometimes error came out.
    I think the deallocation function in the U3D library insecure.

    Not only this but also there are some other memory leak points found.

    any idea or help please?

     
    • Michail Vidiassov

      The memory leak found

      how was it found?

      sometimes error came out.

      what error?

      I think the deallocation function in the U3D library insecure.

      No comment on security, but I remember that something like smart pointers is implemented in the library.
      You can change the memory allocation routines to print out usage counters as they increase and decrease and so monitor memory allocation and deallocation.
      Used that in my own hunt for memory leaks (but years ago, so I have forgotten details).

       
      • dotorimook

        dotorimook - 2013-10-22

        How can I print out the usage counters?

         
  • dotorimook

    dotorimook - 2013-10-22

    In addition, I made a function like follow and used it:

    IFXRESULT createGroupNodeByName(IFXString groupNodeName, IFXSceneGraph pSceneGraph, IFXString strParent, IFXPalette pNodePalette)
    {

    IFXRESULT result = IFX_OK;
    
    U32 groupNodeID = 0;
    IFXPalette* pGroupPalette = NULL;
    IFXNode* pGroupNode = NULL;
    IFXNode* pParentNode = NULL;
    
    IFXUnknown* temp;
    U32 tempId = 0;
    
    if(IFXSUCCESS(result))
        result = IFXCreateComponent(CID_IFXGroup, IID_IFXNode , (void**)&pGroupNode);
    
    if(IFXSUCCESS(result))
        result = pGroupNode->SetSceneGraph(pSceneGraph);
    
    if(IFXSUCCESS(result))
        result = pSceneGraph->GetPalette(IFXSceneGraph::NODE, &pGroupPalette);
    
    if(IFXSUCCESS(result))
    {
        result = pGroupPalette->Add(groupNodeName, &groupNodeID);
    
        if(result == IFX_W_ALREADY_EXISTS)
            result = IFX_OK;
    }
    
    if(IFXSUCCESS(result))
        result = pGroupPalette->SetResourcePtr( groupNodeID, pGroupNode);
    
    if(IFXSUCCESS(result))
        result = pNodePalette->Find(&strParent,&tempId);
    
    if(IFXSUCCESS(result))
        result = pNodePalette->GetResourcePtr(tempId,&temp);
    
    if(IFXSUCCESS(result))
        result = temp->QueryInterface(IID_IFXNode, (void**)&pParentNode);
    
    if (IFXSUCCESS(result))
        result = pGroupNode->AddParent(pParentNode);
    
    IFXRELEASE(pGroupNode);
    IFXRELEASE(pGroupPalette);
    
    return result;
    

    }

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks