private WaitForPendingFinalizers ( ) : void | ||
Résultat | void |
internal void DecodePartition(byte[] buffer) { #if ENABLE_LOCAL_BYTE_IO_ACCESS List <LocalByteArray> partitions = new List <LocalByteArray>(); LocalByteArray tmp_Crt = new LocalByteArray(); #else List <byte[]> partitions = new List <byte[]>(); List <byte> tmp_Crt = new List <byte>(); #endif for (int pos = 0; pos < buffer.Length; pos++) { byte by = buffer[pos]; // end of stream if (pos == buffer.Length - 1) { partitions.Add(tmp_Crt.ToArray()); break; } if (by == 255) { // partition divisor partitions.Add(tmp_Crt.ToArray()); #if ENABLE_LOCAL_BYTE_IO_ACCESS tmp_Crt.Dispose(); tmp_Crt = new LocalByteArray(); #else tmp_Crt.Clear(); tmp_Crt = new List <byte>(); #endif #if USE_OPTIMIZATIONS GC.Collect(); GC.WaitForPendingFinalizers(); // wait for memory clear #endif continue; } else { byte n = Format128UnsignedTo255Byte(by); tmp_Crt.Add(n); continue; } } #if ENABLE_LOCAL_BYTE_IO_ACCESS foreach (byte[] tmp in partitions) { this.PartitionsDecoded.Add(tmp); } #else this.PartitionsDecoded.AddRange(partitions); #endif #if ENABLE_LOCAL_BYTE_IO_ACCESS foreach (LocalByteArray n in partitions) { n.Dispose(); } partitions.Clear(); tmp_Crt.Dispose(); #else partitions.Clear(); partitions = null; tmp_Crt.Clear(); tmp_Crt = null; #endif GC.Collect(); }