Posted 20 years ago
by Nicols C.

Hi,
I am working with SyntaxEditor (v.2.5.133.0) in an application that needs to add and remove editors (like Visual Studio IDE). Use multiples documents and one editor, is not an option because multiples editors could be visible simultaneously. So, I need to create new instances of SyntaxEditor and release them when they are not needed.
I notice that the instances of SyntaxEditor are not collected by Garbage Collector correctly. With the following code the problem could be reproduced:
ActiproSoftware.SyntaxEditor.SyntaxEditor x;
x = new ActiproSoftware.SyntaxEditor.SyntaxEditor();
WeakReference w;
w = new WeakReference(x);
x.Dispose();
x = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
MessageBox.Show("IsAlive: " + w.IsAlive);
Any suggestion to avoid this problem?
Thanks,
Nicols
I am working with SyntaxEditor (v.2.5.133.0) in an application that needs to add and remove editors (like Visual Studio IDE). Use multiples documents and one editor, is not an option because multiples editors could be visible simultaneously. So, I need to create new instances of SyntaxEditor and release them when they are not needed.
I notice that the instances of SyntaxEditor are not collected by Garbage Collector correctly. With the following code the problem could be reproduced:
ActiproSoftware.SyntaxEditor.SyntaxEditor x;
x = new ActiproSoftware.SyntaxEditor.SyntaxEditor();
WeakReference w;
w = new WeakReference(x);
x.Dispose();
x = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
MessageBox.Show("IsAlive: " + w.IsAlive);
Any suggestion to avoid this problem?
Thanks,
Nicols