Do not copy the spec during attach.
Use a reference count for managing the memory. PiperOrigin-RevId: 716169486 Change-Id: Id270c4858c17b9250115e9544d5ea143584e2d5f
This commit is contained in:
committed by
Copybara-Service
parent
6436055c6c
commit
c2138c3fb0
@@ -945,10 +945,16 @@ void mjXReader::Parse(XMLElement* root, const mjVFS* vfs) {
|
||||
Keyframe(section);
|
||||
}
|
||||
|
||||
// set deepcopy flag to true to copy child specs during attach calls
|
||||
mjs_setDeepCopy(spec, true);
|
||||
|
||||
for (XMLElement* section = FirstChildElement(root, "worldbody"); section;
|
||||
section = NextSiblingElement(section, "worldbody")) {
|
||||
Body(section, mjs_findBody(spec, "world"), nullptr, vfs);
|
||||
}
|
||||
|
||||
// set deepcopy flag to false to disable copying during attach in all future calls
|
||||
mjs_setDeepCopy(spec, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user