public void Clear()
{
this.buffer.Clear();
+ System.Runtime.GCSettings.LargeObjectHeapCompactionMode = System.Runtime.GCLargeObjectHeapCompactionMode.CompactOnce;
+ GC.Collect();
this.Dirty = false;
}
{
#region Fields
- private const int MIN_CAPACITY = 4;
+ private const int MIN_CAPACITY = 128;
private T[] _buffer;
private int _gapStart;
if (required > (this._gapEnd - this._gapStart))
{
// Calculate a new size (double the size necessary)
- int newCapacity = (Count + required) * 2;
+ int newCapacity = Count + required + MIN_CAPACITY;
if (newCapacity < MIN_CAPACITY)
newCapacity = MIN_CAPACITY;
internal void Clear()
{
this.buf.Clear();
+ this.buf.TrimExcess();
this.Update(this, new DocumentUpdateEventArgs(UpdateType.Clear, 0, this.buf.Count, 0));
}
if (result == true)
{
this.fooTextBox.IsEnabled = false;
- await this.fooTextBox.LoadFileAsync(ofd.FileName, Encoding.Default,this.cancleTokenSrc);
+ System.IO.FileStream file = System.IO.File.Open(ofd.FileName,System.IO.FileMode.Open);
+ System.IO.StreamReader sr = new System.IO.StreamReader(file, Encoding.Default);
+ await this.fooTextBox.Document.LoadAsync(sr, this.cancleTokenSrc, (int)file.Length);
+ sr.Close();
+ file.Close();
this.fooTextBox.IsEnabled = true;
this.fooTextBox.Refresh();
}