dispose some MemoryStreams

httptests
UbitUmarov 2017-05-06 17:47:43 +01:00
parent ae191cd304
commit eb93855d84
2 changed files with 14 additions and 10 deletions

View File

@ -163,13 +163,15 @@ namespace OpenSim.Data.MySQL
if (m_enableCompression) if (m_enableCompression)
{ {
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) using(GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data),
CompressionMode.Decompress))
{ {
MemoryStream outputStream = new MemoryStream(); using(MemoryStream outputStream = new MemoryStream())
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); {
// int compressedLength = asset.Data.Length; WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
asset.Data = outputStream.ToArray(); // int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat( // m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength); // asset.ID, asset.Name, asset.Data.Length, compressedLength);

View File

@ -173,13 +173,15 @@ namespace OpenSim.Data.PGSQL
if (m_enableCompression) if (m_enableCompression)
{ {
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) using (GZipStream decompressionStream = new GZipStream( new MemoryStream(asset.Data),
CompressionMode.Decompress))
{ {
MemoryStream outputStream = new MemoryStream(); using(MemoryStream outputStream = new MemoryStream())
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); {
WebUtil.CopyStream(decompressionStream,outputStream,int.MaxValue);
// int compressedLength = asset.Data.Length; // int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray(); asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat( // m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength); // asset.ID, asset.Name, asset.Data.Length, compressedLength);