Skip to content

Commit 9f3d2f6

Browse files
committed
Fixed leaks which were causing generation to use too much memory.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
1 parent d279d68 commit 9f3d2f6

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

QtSharp.CLI/Program.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ public static int Main(string[] args)
8585
foreach (var libFile in libFiles)
8686
{
8787
parserOptions.FileName = libFile;
88-
var parserResult = ClangParser.ParseLibrary(parserOptions);
89-
if (parserResult.Kind == ParserResultKind.Success)
88+
using (var parserResult = ClangParser.ParseLibrary(parserOptions))
9089
{
91-
dependencies[libFile] = CppSharp.ClangParser.ConvertLibrary(parserResult.Library).Dependencies;
92-
}
93-
else
94-
{
95-
dependencies[libFile] = Enumerable.Empty<string>();
90+
if (parserResult.Kind == ParserResultKind.Success)
91+
{
92+
dependencies[libFile] = CppSharp.ClangParser.ConvertLibrary(parserResult.Library).Dependencies;
93+
}
94+
else
95+
{
96+
dependencies[libFile] = Enumerable.Empty<string>();
97+
}
9698
}
9799
}
98100
var modules = new List<string>

QtSharp/CompileInlinesPass.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ public override bool VisitLibrary(ASTContext library)
4747
var parserOptions = new ParserOptions();
4848
parserOptions.addLibraryDirs(dir);
4949
parserOptions.FileName = inlines;
50-
var parserResult = ClangParser.ParseLibrary(parserOptions);
51-
if (parserResult.Kind == ParserResultKind.Success)
50+
using (var parserResult = ClangParser.ParseLibrary(parserOptions))
5251
{
53-
var nativeLibrary = CppSharp.ClangParser.ConvertLibrary(parserResult.Library);
54-
this.Driver.Symbols.Libraries.Add(nativeLibrary);
55-
this.Driver.Symbols.IndexSymbols();
52+
if (parserResult.Kind == ParserResultKind.Success)
53+
{
54+
var nativeLibrary = CppSharp.ClangParser.ConvertLibrary(parserResult.Library);
55+
this.Driver.Symbols.Libraries.Add(nativeLibrary);
56+
this.Driver.Symbols.IndexSymbols();
57+
}
5658
}
5759
return true;
5860
}

QtSharp/Documentation.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ public void DocumentProperty(Property property)
277277
var name = macroExpansion.Text.Split(' ')[1];
278278
if (name == property.Name || name == alternativeName)
279279
{
280-
property.LineNumberStart = macroExpansion.LineNumberStart;
281-
property.LineNumberEnd = macroExpansion.LineNumberEnd;
282280
property.Name = name;
283281
this.DocumentQtProperty(property);
284282
return;

0 commit comments

Comments
 (0)