Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBX SDK 2016.1.1 FbxImporter memory leaks

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
791 Views, 2 Replies

FBX SDK 2016.1.1 FbxImporter memory leaks

There are multiple memory leaks when using FBX SDK 2016.1.1 to import a .fbx file. I am testing on Windows x64 using Visual Studio 2017 (with Visual Studio 2015 Platform Toolset v140) and I am statically linking to vs2015/x64/Release/libfbxsdk-mt.lib.

 

Here is minimal code that reproduces the issue:

 

 

FbxManager* fbx_manager = FbxManager::Create();
FbxIOSettings* io_settings = FbxIOSettings::Create(fbx_manager, IOSROOT);
fbx_manager->SetIOSettings(io_settings);
FbxImporter* importer = FbxImporter::Create(fbx_manager, "");
importer->Initialize("cat.fbx", -1, fbx_manager->GetIOSettings());
fbx_manager->Destroy();

 

After running this code there is 9.53 KB of memory on the heap that hasn't been deallocated. Most (but not all) of the leaks come from many small allocations in the FbxFileUtils::Exist function, as seen in this callstack:

 

 

taki.exe!_calloc_base() - Line 38	C++
taki.exe!create_environment<char>() - Line 129	C++
taki.exe!common_initialize_environment_nolock<char>() - Line 184	C++
taki.exe!__dcrt_get_or_create_narrow_environment_nolock() - Line 308	C++
taki.exe!common_getenv_nolock<char>() - Line 30	C++
taki.exe!common_getenv_s<char>() - Line 157	C++
taki.exe!tzset_nolock() - Line 298	C++
taki.exe!__tzset() - Line 355	C++
taki.exe!common_loctotime_t<__int64>() - Line 64	C++
taki.exe!convert_filetime_to_time_t<__int64>() - Line 316	C++
taki.exe!common_stat_handle_file_opened<_stat64>() - Line 441	C++
taki.exe!common_stat<_stat64>() - Line 474	C++
taki.exe!fbxsdk::FbxFileUtils::Exist(char const * __ptr64)()	C++
taki.exe!fbxsdk::FbxCachedFile::Open(char const * __ptr64,enum fbxsdk::FbxFile::EMode,bool) __ptr64()	C++
taki.exe!fbxsdk::FbxChainedFile::Open(char const * __ptr64,enum fbxsdk::FbxFile::EMode,bool,unsigned __int64) __ptr64()	C++
taki.exe!fbxsdk::FbxIO::ProjectOpen(char const * __ptr64,class fbxsdk::FbxReader * __ptr64,bool,bool,class fbxsdk::FbxIOFileHeaderInfo * __ptr64) __ptr64()	C++
taki.exe!fbxsdk::FbxReaderFbx5::FileOpen(char * __ptr64) __ptr64()	C++
taki.exe!fbxsdk::CreateFBXReader(class fbxsdk::FbxManager & __ptr64,class fbxsdk::FbxImporter & __ptr64,int,int)()	C++
taki.exe!fbxsdk::FbxImporter::FileOpen(class fbxsdk::FbxFile * __ptr64) __ptr64()	C++
taki.exe!fbxsdk::FbxImporter::Initialize(char const * __ptr64,int,class fbxsdk::FbxIOSettings * __ptr64) __ptr64()	C++

 

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

I was able to confirm that this issue still exists in FBX SDK  2017.1.

Message 3 of 3
Anonymous
in reply to: Anonymous

Sorry, I was mistaken. The memory leaks are due to not giving enough time for CRT to clean up its internal allocations. When testing with the _CRTDBG_LEAK_CHECK_DF flag set, it can be seen that there are no leaks within the FBX SDK with the above code. Feel free to close/delete this thread.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report