Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Lines go missing on Linux with tcmalloc

mdeabreu
Participant
Participant

Lines go missing on Linux with tcmalloc

mdeabreu
Participant
Participant
Hello,

We've got a product and have integrated the FBX SDK into it, we recently noticed that lines would go missing in certain cases. We've been able to narrow this down to attempting to read a file on Linux with tcmalloc enabled. This implies that there is a memory related bug in the SDK. We have been able to reproduce this issue by using the following C++ code and the latest SDK 2020.2.1


Without tcmalloc the expected results are:

 

$ ./fbxread testsuite/TestSuite/Tests/17000/17761/SourceDataset/lines.fbx
Node at position 0: Line001
fbxline->GetEndPointCount(): 1
fbxline->GetEndPointAt(0): 1
Node at position 1: Line002
fbxline->GetEndPointCount(): 1
fbxline->GetEndPointAt(0): 1
Node at position 2: Line003
fbxline->GetEndPointCount(): 3
fbxline->GetEndPointAt(0): 3
fbxline->GetEndPointAt(1): 7
fbxline->GetEndPointAt(2): 10



 

With tcmalloc, the bad results are:




This is pretty bad for us as the lines can go missing and cause data loss for our customers. We've had to disable FBX support on Linux until we can get this fixed as we don't want to silently corrupt customer data.

 

$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so ./fbxread testsuite/TestSuite/Tests/17000/17761/SourceDataset/lines.fbx
Node at position 0: Line001
fbxline->GetEndPointCount(): 1
fbxline->GetEndPointAt(0): 1
Node at position 1: Line002
fbxline->GetEndPointCount(): 0
Node at position 2: Line003
fbxline->GetEndPointCount(): 3
fbxline->GetEndPointAt(0): 3
fbxline->GetEndPointAt(1): 7
fbxline->GetEndPointAt(2): 10
​



 

Any help would be greatly appreciated!

 

Thanks,
Matthew
0 Likes
Reply
257 Views
1 Reply
Reply (1)

regalir
Autodesk
Autodesk

The FBX SDK uses malloc as the default memory allocation. I am not familiar with tcmalloc but it looks like the two memory managements cannot coexist. You can try to switch the memory management functions for the FBX SDK by using the following:

    FbxSetMallocHandler(your malloc function);
    FbxSetReallocHandler(your realloc function);
    FbxSetFreeHandler(your free function);
    FbxSetCallocHandler(your calloc function);

 

since the FbxNew and FbxDelete functions are calling the FbxMalloc/FbxFree functions all the memory management should be redirected to tcmalloc.

0 Likes