I'd have to see the loading code to know for sure. But in the past when I've seen this the memory consumption can be greatly reduced by loading into Scintilla this way:
- Declare a byte buffer.
- Read a chunk from your file directly into your buffer.
- Directly call the native Scintilla's AppendText function passing a pointer to the buffer.
// Fill the buffer, record how many bytes are actually used in variable "length".
// Don't use buffer.Length unless the entire array is filled.
fixed (byte* bp = buffer)
scintilla.NativeInterface.SendMessageDirect(ScintillaNET.Constants.SCI_APPENDTEXT, (IntPtr)length, (IntPtr)bp);
This avoids the extra memory of converting the binary data (from source) into a .NET string, ScintillaNet adding a null terminator (for c based string handling) which of course allocates another string, converting that string back to a byte, then passing
the string onto Scintilla. Additionally most of the higher level Scintilla APIs will create a range object that you may not need.