Skip to content

Commit

Permalink
Fix memory leak in IDE mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
someone-with-default-username committed Jul 23, 2016
1 parent 3e6cee1 commit b1ec554
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -52,7 +52,7 @@ namespace Nemerle.Completion2

public Close() : void
{
AsyncWorker.AddWork(AsyncRequest(AsyncRequestType.CloseProject, this, null, _ => ()));
AsyncWorker.AddWork(AsyncRequest(AsyncRequestType.CloseProject, this, null, _ => CleanUpTypes()));
}

// HACK: see usings
Expand Down
Expand Up @@ -596,10 +596,6 @@ public override ParseRequest BeginParse(int line, int idx, TokenInfo info, Parse

public override void Dispose()
{
SmartIndent = null;
MethodData = null;
_tipAsyncRequest = null;

if (ProjectInfo != null)
{
ProjectInfo.RemoveEditableSource(this);
Expand All @@ -617,6 +613,22 @@ public override void Dispose()
ProjectInfo = null;
}

SmartIndent = null;
MethodData = null;
_tipAsyncRequest = null;
CompileUnit = null;
Declarations = null;
Service = null;

if (_relocationRequestsQueue != null)
_relocationRequestsQueue.Clear();

if (TypeLocations != null)
TypeLocations.Clear();

if (MethodsTypeLocations != null)
MethodsTypeLocations.Clear();

base.Dispose();
}

Expand Down
Expand Up @@ -757,7 +757,11 @@ protected override void Dispose(bool disposing)
{
if (!_suppressDispose)
{
ProjectInfo.Close();
if (_projectInfo != null)
{
_projectInfo.Close();
_projectInfo = null;
}
base.Dispose(disposing);
}
}
Expand Down

0 comments on commit b1ec554

Please sign in to comment.