From 5038a59ef31cdfcf0d1bc1fc61ebdb3728d280c1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Feb 2014 00:15:20 +0000 Subject: Maybe slightly reduce warp3d memory leakage by disposing of decoded bitmap in Warp3DImageModule.GetTexture() However, this still appears to be leaking massively, at least for me. Possible cause is warp3D using GDI objects internally and not disposing of them. --- .../CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index be328a7..23dee56 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -189,6 +189,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap } WarpRenderer renderer = new WarpRenderer(); + renderer.CreateScene(width, height); renderer.Scene.autoCalcNormals = false; @@ -243,9 +244,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap obj.vertexData = null; obj.triangleData = null; } + renderer.Scene.removeAllObjects(); renderer = null; viewport = null; + m_colors.Clear(); GC.Collect(); m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); @@ -637,21 +640,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap if (asset != null) { IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface(); - Bitmap img = null; try { - img = (Bitmap)imgDecoder.DecodeToImage(asset); + using (Bitmap img = (Bitmap)imgDecoder.DecodeToImage(asset)) + ret = new warp_Texture(img); } catch (Exception e) { m_log.Warn(string.Format("[WARP 3D IMAGE MODULE]: Failed to decode asset {0}, exception ", id), e); - } - - if (img != null) - { - return new warp_Texture(img); - } + } } return ret; -- cgit v1.1