Managing memory with SDK Manager
 
 
 

ImportExport()declares an SDK manager object and a scene object, and then callsInitializeSDKObjects()to instantiate and initialize them:

 KFbxSdkManager* lSdkManager;
 KFbxScene* lScene
 // Initialize the KFbxSdkManager and the KFbxScene
 InitializeSdkObjects(lSdkManager, lScene);

Class KFbxSdkManageris the SDK manager, whose main purpose is to manage memory for FBX by keeping track of FBX objects that have been allocated and destroyed.

An FBX application or plugin typically begins by creating an SDK manager object. This is how ImportExport’sInitializeSdkObjects()does it:

void InitializeSdkObjects(
 KFbxSdkManager*& pSdkManager,
 KFbxScene*& pScene
 )
{
 pSdkManager = KFbxSdkManager::CreateKFbxSdkManager();
 if (!pSdkManager)
 {
 UI_Printf("Unable to create the FBX SDK manager");
 exit(0);
 }

For almost all classes in the FBX SDK, you instantiate an object by calling the class’screate()method. You pass your SDK manager object as a parameter:

 // Create the scene object. The scene will hold the data
 // in the file to be imported.
 pScene = KFbxScene::Create(pSdkManager,"");
}

The SDK manager allocates memory for the new object (in this case, a scene). Later, when you no longer need the object, the SDK manager “destroys” it (seeCleaning up and shutting down).