Skip to content Skip to sidebar Skip to footer

Out Of Memory Error In Loading Multiple Models In Forge Viewer

I am working on a project that has 14 Navisworks (NWC) models. I am able to load the composite model into the viewer (which takes some time but works). However, when I am loading m

Solution 1:

Is there a way to stop Viewer creating more geometry before it runs out of memory?

Try and limit the memory consumption in your load options:

var config3d = {
    memory: {
        limit: 1024// in MB
    }
};
var viewer = new Autodesk.Viewing.Viewer3D(container, config3d);

BTW the default limits are:

Desktop 600 MB
Mobile  195 MB

Is there a way to find statistics of all models with DebugTools extension?

Unfortunately the built-in DebugTools does not work with multiple models.

But that shouldn't stop you from querying stats on a per model basis:

letmodelArray = viewer.impl.modelQueue().getModels();
lettargetModel = modelArray[index];
targetModel.getGeometryList() // retrieves geometry info about a specific model

You can even bake an extension of your own to suit multiple models.

Is there another way to count polygons of loaded models?

model.getGeometryList().geomPolyCount

Solution 2:

I am not sure that is right way or not but I noticed, NOP_VIEWERS objects are not releasing because of that may be you get out of memory. so when you switching or changing your model while loading into viewer call below function. that will remove existing viewers objects from memory and release your memory.

function clearModels() {
 //remove currently loaded objectdelete(NOP_VIEWER); 
 //remove previously loaded model objects
 NOP_VIEWERS.forEach(nviewer => { nviewer.finish(); delete(nviewer); }); 
} 

Post a Comment for "Out Of Memory Error In Loading Multiple Models In Forge Viewer"