There are 484471 faces in the created SketchUp model. I don’t attach this model because its size is 80M. I just share it here “\\shacng109wqm5\share\perf\13-00 asm_1.skp”.
From the following result when create this SketchUp model, we can see the peak memory cost(364M and 520M) happened in the SketchUp API is expensive. I want to know whether the memory cost is as designed or not.
I am just curious why calling SUEntitiesFill(…) costs 520M. From my point of view, all faces have been added into the geometry input.
Add all faces into SUGeometryInputRef object by following SketchUp API: cost364M
SULoopInputCreate(SULoopInputRef* loop_input)
SUGeometryInputAddVertex(SUGeometryInputRef geom_input, const struct SUPoint3D* point)
SULoopInputAddVertexIndex(SULoopInputRef loop_input, size_t vertex_index)
SUGeometryInputAddFace(SUGeometryInputRef geom_input, SULoopInputRef* outer_loop, size_t* added_face_index)
Add SUGeometryInputRef object into model by the following API: cost 520M
SUEntitiesFill(SUEntitiesRef entities, SUGeometryInputRef geom_input, true)
SUGeometryInput just holds some temporary data structures to be used as input to SUEntitiesFill, which then takes this input and turns it into actual internal SketchUp data structures. After the call, you need to delete the geometry input object but you’ll still have all the geometry in the model. What’s the memory usage after that?
For Geo, sorry for the link. If you still need the model, I will send you by other way later.
For bugra, I can assume that calling SUEntitiesFill(…) should cause one copy for all temporary data structures in SUGeometryInput, am I correct? Even if so, there is still 156M(520M-364M) more memory cost when calling SUEntitiesFill(…). Is there other operation to cost 156M more memory?
In addition, I also call SUGeometryInputRelease(…) for SUGeometryInput. It does release 271M. But there is still 93M(364M-271M) not released. Is there any memory leak here?
It’s not really a copy, it takes rudimentary input data structures (i.e. SUGeometryInputRef) and turns it into real SketchUp data structures. It is hard to say whether 156MB is warranted for the model you are looking at. Data structures are pretty complicated.
I’m not sure if I am having the same issue or not. But I have noticed that when using SUEntitiesFill in windows 8, it is a lot slower than windows 7. I create a vector of SUGeometryInputRef, it has some 10,000 geo inputs. In windows 7 it takes less than 3 seconds. In windows 8 it takes a little over 30 seconds! Any thoughts?
So…what is the work around with something like that, other than disabling it or adding sketchup.exe to the protection program. Is there anything I can add in my code that will work around this?