From 2e6c978e78f57d9b0de38a7c6bbe0296173a26ce Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Fri, 18 Oct 2013 12:28:17 -0700 Subject: [PATCH] Fixes #30 --- modulecache.d | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modulecache.d b/modulecache.d index 280033d..50d27cf 100644 --- a/modulecache.d +++ b/modulecache.d @@ -129,9 +129,14 @@ struct ModuleCache LexerConfig config; config.fileName = location; auto tokens = source.byToken(config).array(); - Module mod = parseModule(tokens, location, &doesNothing); + symbols = convertAstToSymbols(tokens, location); - symbols = convertAstToSymbols(mod, location); + // Parsing allocates a lot of AST nodes. We can greatly reduce the + // program's idle memory use by running the GC here. + // TODO: Re-visit this when D gets a precise GC. + import core.memory; + GC.collect(); + GC.minimize(); } catch (Exception ex) { @@ -208,5 +213,3 @@ private: // Listing of paths to check for imports static string[] importPaths; } - -private void doesNothing(string a, int b, int c, string d) {}