Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize memory usage #780

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dsymbol/src/dsymbol/modulecache.d
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct ModuleCache
DSymbol* cacheModule(string location)
{
import std.stdio : File;
import core.memory: GC;

assert (location !is null);

Expand All @@ -160,6 +161,8 @@ struct ModuleCache
if (!needsReparsing(cachedLocation))
return getEntryFor(cachedLocation).symbol;

scope(exit) GC.collect();

recursionGuard.insert(&cachedLocation.data[0]);

File f = File(cachedLocation);
Expand Down
3 changes: 3 additions & 0 deletions src/dcd/server/autocomplete/complete.d
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ enum CalltipHint {
public AutocompleteResponse complete(const AutocompleteRequest request,
ref ModuleCache moduleCache)
{
import core.memory: GC;
scope(exit) GC.collect();

const(Token)[] tokenArray;
auto stringCache = StringCache(request.sourceCode.length.optimalBucketCount);
auto beforeTokens = getTokensBeforeCursor(request.sourceCode,
Expand Down
Loading