diff options
author | UbitUmarov | 2017-05-06 17:47:43 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-06 17:47:43 +0100 |
commit | eb93855d84414be6c9e927c0da3be56ae6831573 (patch) | |
tree | e2fdd8d067efef8ecccc7118549fa55082e0b2ec | |
parent | dispose some MemoryStreams (diff) | |
download | opensim-SC-eb93855d84414be6c9e927c0da3be56ae6831573.zip opensim-SC-eb93855d84414be6c9e927c0da3be56ae6831573.tar.gz opensim-SC-eb93855d84414be6c9e927c0da3be56ae6831573.tar.bz2 opensim-SC-eb93855d84414be6c9e927c0da3be56ae6831573.tar.xz |
dispose some MemoryStreams
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLXAssetData.cs | 10 |
2 files changed, 14 insertions, 10 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 2ef7f8f..23f6837 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -163,13 +163,15 @@ namespace OpenSim.Data.MySQL | |||
163 | 163 | ||
164 | if (m_enableCompression) | 164 | if (m_enableCompression) |
165 | { | 165 | { |
166 | using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) | 166 | using(GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), |
167 | CompressionMode.Decompress)) | ||
167 | { | 168 | { |
168 | MemoryStream outputStream = new MemoryStream(); | 169 | using(MemoryStream outputStream = new MemoryStream()) |
169 | WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); | 170 | { |
170 | // int compressedLength = asset.Data.Length; | 171 | WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); |
171 | asset.Data = outputStream.ToArray(); | 172 | // int compressedLength = asset.Data.Length; |
172 | 173 | asset.Data = outputStream.ToArray(); | |
174 | } | ||
173 | // m_log.DebugFormat( | 175 | // m_log.DebugFormat( |
174 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", | 176 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", |
175 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | 177 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); |
diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs index 6e88489..000a446 100644 --- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs | |||
@@ -173,13 +173,15 @@ namespace OpenSim.Data.PGSQL | |||
173 | 173 | ||
174 | if (m_enableCompression) | 174 | if (m_enableCompression) |
175 | { | 175 | { |
176 | using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) | 176 | using (GZipStream decompressionStream = new GZipStream( new MemoryStream(asset.Data), |
177 | CompressionMode.Decompress)) | ||
177 | { | 178 | { |
178 | MemoryStream outputStream = new MemoryStream(); | 179 | using(MemoryStream outputStream = new MemoryStream()) |
179 | WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); | 180 | { |
181 | WebUtil.CopyStream(decompressionStream,outputStream,int.MaxValue); | ||
180 | // int compressedLength = asset.Data.Length; | 182 | // int compressedLength = asset.Data.Length; |
181 | asset.Data = outputStream.ToArray(); | 183 | asset.Data = outputStream.ToArray(); |
182 | 184 | } | |
183 | // m_log.DebugFormat( | 185 | // m_log.DebugFormat( |
184 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", | 186 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", |
185 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | 187 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); |