diff options
author | Justin Clarke Casey | 2009-03-24 20:48:27 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-24 20:48:27 +0000 |
commit | 0bf2177dfb9d2c326123921b07c0111d985b5a88 (patch) | |
tree | 23fa32732078876565755c27fa85e0e823223d40 | |
parent | * minor: remove mono compiler warnings (diff) | |
download | opensim-SC_OLD-0bf2177dfb9d2c326123921b07c0111d985b5a88.zip opensim-SC_OLD-0bf2177dfb9d2c326123921b07c0111d985b5a88.tar.gz opensim-SC_OLD-0bf2177dfb9d2c326123921b07c0111d985b5a88.tar.bz2 opensim-SC_OLD-0bf2177dfb9d2c326123921b07c0111d985b5a88.tar.xz |
* Use memory more efficiently when loading oars
* This change starts the script immediately after an object is loaded, rather than waiting till they are all loaded
* This should be okay, but please report any new errors
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 03e4bce..5c9f755 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -167,10 +167,24 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
167 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); | 167 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); |
168 | 168 | ||
169 | IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); | 169 | IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); |
170 | ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 170 | int sceneObjectsLoadedCount = 0; |
171 | |||
171 | 172 | ||
172 | foreach (string serialisedSceneObject in serialisedSceneObjects) | 173 | foreach (string serialisedSceneObject in serialisedSceneObjects) |
173 | { | 174 | { |
175 | m_log.DebugFormat("[ARCHIVER]: Loading xml with raw size {0}", serialisedSceneObject.Length); | ||
176 | |||
177 | // Really large xml files (multi megabyte) appear to cause | ||
178 | // memory problems | ||
179 | // when loading the xml. But don't enable this check yet | ||
180 | /* | ||
181 | if (serialisedSceneObject.Length > 5000000) | ||
182 | { | ||
183 | m_log.Error("[ARCHIVER]: Ignoring xml since size > 5000000);"); | ||
184 | continue; | ||
185 | } | ||
186 | */ | ||
187 | |||
174 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); | 188 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); |
175 | 189 | ||
176 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned | 190 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned |
@@ -222,26 +236,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
222 | 236 | ||
223 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) | 237 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) |
224 | { | 238 | { |
225 | sceneObjects.Add(sceneObject); | 239 | sceneObjectsLoadedCount++; |
240 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); | ||
226 | } | 241 | } |
227 | } | 242 | } |
228 | 243 | ||
229 | m_log.InfoFormat("[ARCHIVER]: Restored {0} scene objects to the scene", sceneObjects.Count); | 244 | m_log.InfoFormat("[ARCHIVER]: Restored {0} scene objects to the scene", sceneObjectsLoadedCount); |
230 | 245 | ||
231 | int ignoredObjects = serialisedSceneObjects.Count - sceneObjects.Count; | 246 | int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; |
232 | 247 | ||
233 | if (ignoredObjects > 0) | 248 | if (ignoredObjects > 0) |
234 | m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); | 249 | m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); |
235 | 250 | ||
236 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); | 251 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); |
237 | 252 | ||
238 | m_log.Debug("[ARCHIVER]: Starting scripts"); | ||
239 | |||
240 | foreach (SceneObjectGroup sceneObject in sceneObjects) | ||
241 | { | ||
242 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); | ||
243 | } | ||
244 | |||
245 | m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); | 253 | m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); |
246 | } | 254 | } |
247 | 255 | ||