Release Memory

Topics: Developer Forum, User Forum
Nov 12, 2013 at 11:15 AM
Hi,
I have been using the .NET (ScintillaNET.dll - 2.5.2) for quite sometime in a log analyser program that would load the text in one chunk (using VB.NET).
Now that I have implemented chunking to load large files, when loading each page I clear the contents of the previous chunk using:

Scintilla_RawLogFile.ResetText()

However, this does not seem to release the memory from each reload and when loading in additional pages (chunks) using either of the commands below the memory keeps growing until the program crashes with an out of memory error:

Scintilla_RawLogFile.Text = Chunks(currentChunk).Text

or

Scintilla_RawLogFile.AppendText(Chunks(currentChunk).Text)

Is there a way or method to release this overhead that Scintilla uses?

Cheers
Coordinator
Feb 18, 2014 at 2:39 AM
Do you have a sample program which illustrates this problem? I understand that you believe it is a problem with ScintillaNET but I'm not entirely convinced it is. I suspect that you're misunderstanding how ScintillaNET handles text but I can't be sure until I see an example.

Thanks,
Jacob
Feb 20, 2014 at 2:25 PM
Hi Jacob,
unfortunately this is part of a larger application so do not have a smaller program. The issue is experienced when placing a large amount of text into the control, then attempting to place the next chunk of text to be displayed, after clearing the previous text (from all buffers as it is not needed). However all attempts to do this appeared not to release the memory allocated when placing in the text, therefore the program grew till it crashed.

I ended up getting around this by releasing and re-instantiating the control - which allowed the memory to be released and memory map to not grow.

As mentioned, I was after the correct way/call to remove all the previous text and memory allocated when this text is displayed - maybe this is my misunderstanding of the control and I was after clarification on how to do this correctly.

Cheers
Coordinator
Mar 26, 2014 at 1:33 AM
To answer your question: replacing the entire control contents by calling ResetText/AppendText or just setting the Text property is the correct way to replace all the text in the control.

Thanks,
Jacob