mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:52:57 +02:00
Fix entity server memory leak and improve performance
This commit is contained in:
parent
79cf24d30f
commit
33bdd841c1
2 changed files with 5 additions and 8 deletions
|
@ -2553,9 +2553,7 @@ bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer
|
||||||
}
|
}
|
||||||
entityDescription["DataVersion"] = _persistDataVersion;
|
entityDescription["DataVersion"] = _persistDataVersion;
|
||||||
entityDescription["Id"] = _persistID;
|
entityDescription["Id"] = _persistID;
|
||||||
// V8TODO: Creating new script engine each time is very inefficient
|
RecurseOctreeToMapOperator theOperator(entityDescription, element, scriptEngine.get(), skipDefaultValues,
|
||||||
ScriptEnginePointer engine = newScriptEngine();
|
|
||||||
RecurseOctreeToMapOperator theOperator(entityDescription, element, engine.get(), skipDefaultValues,
|
|
||||||
skipThoseWithBadParents, _myAvatar);
|
skipThoseWithBadParents, _myAvatar);
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
|
@ -2704,8 +2702,6 @@ bool EntityTree::readFromMap(QVariantMap& map, const bool isImport) {
|
||||||
// to a ScriptValue, and then to EntityItemProperties. These properties are used
|
// to a ScriptValue, and then to EntityItemProperties. These properties are used
|
||||||
// to add the new entity to the EntityTree.
|
// to add the new entity to the EntityTree.
|
||||||
QVariantList entitiesQList = map["Entities"].toList();
|
QVariantList entitiesQList = map["Entities"].toList();
|
||||||
// V8TODO: Creating new script engine each time is very inefficient
|
|
||||||
ScriptEnginePointer scriptEngine = newScriptEngine();
|
|
||||||
|
|
||||||
if (entitiesQList.length() == 0) {
|
if (entitiesQList.length() == 0) {
|
||||||
qCDebug(entities) << "EntityTree::readFromMap: entitiesQList.length() == 0, Empty map or invalidly formed file";
|
qCDebug(entities) << "EntityTree::readFromMap: entitiesQList.length() == 0, Empty map or invalidly formed file";
|
||||||
|
@ -2881,9 +2877,7 @@ bool EntityTree::readFromMap(QVariantMap& map, const bool isImport) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityTree::writeToJSON(QString& jsonString, const OctreeElementPointer& element) {
|
bool EntityTree::writeToJSON(QString& jsonString, const OctreeElementPointer& element) {
|
||||||
// V8TODO: Creating new script engine each time is very inefficient
|
RecurseOctreeToJSONOperator theOperator(element, scriptEngine.get(), jsonString);
|
||||||
ScriptEnginePointer engine = newScriptEngine();
|
|
||||||
RecurseOctreeToJSONOperator theOperator(element, engine.get(), jsonString);
|
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
});
|
});
|
||||||
|
|
|
@ -385,6 +385,9 @@ private:
|
||||||
// Return an AACube containing object and all its entity descendants
|
// Return an AACube containing object and all its entity descendants
|
||||||
AACube updateEntityQueryAACubeWorker(SpatiallyNestablePointer object, EntityEditPacketSender* packetSender,
|
AACube updateEntityQueryAACubeWorker(SpatiallyNestablePointer object, EntityEditPacketSender* packetSender,
|
||||||
MovingEntitiesOperator& moveOperator, bool force, bool tellServer);
|
MovingEntitiesOperator& moveOperator, bool force, bool tellServer);
|
||||||
|
|
||||||
|
// Script engine for writing entity tree data to and from JSON
|
||||||
|
ScriptEnginePointer scriptEngine{ newScriptEngine() };
|
||||||
};
|
};
|
||||||
|
|
||||||
void convertGrabUserDataToProperties(EntityItemProperties& properties);
|
void convertGrabUserDataToProperties(EntityItemProperties& properties);
|
||||||
|
|
Loading…
Reference in a new issue