Skip to content

[frontend] Don't destroy the compiler instance object inside performCompile() #9260

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

Merged
merged 2 commits into from
May 4, 2017

Conversation

akyrtzi
Copy link
Contributor

@akyrtzi akyrtzi commented May 4, 2017

This permits continuing to use the diagnostic engine object from the instance.

…ompile()

This permits continuing to use the diagnostic engine object from the instance.
@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 4, 2017

@swift-ci smoke test

@akyrtzi akyrtzi requested a review from mxswd May 4, 2017 00:08
@slavapestov
Copy link
Contributor

It would be cleaner to construct the diagnostic engine outside of the compiler instance and pass it in to the instance. Then you can still destroy the entire compiler instance.

@swiftix
Copy link
Contributor

swiftix commented May 4, 2017

Does it have any impact on the memory consumption? In general, we tried to free the memory occupied by the compiler ASAP, to reduce the peak memory usage.

@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 4, 2017

A previous suggestion was to have CompilerInstance keep a shared pointer to a DiagnosticEngine object, and also have the SourceManager reference be a shared pointer since DiagnosticEngine references it, but @DougGregor was not a fan of this, since the DiagnosticEngine in general keeps state that is relevant to a compiler instance (like whether a fatal error occurred, etc.)

@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 4, 2017

@swiftix , the commit still frees the ASTContext and SILModule object, which should account for the vast majority of the memory consumption.

@akyrtzi
Copy link
Contributor Author

akyrtzi commented May 4, 2017

@swift-ci smoke test

@jrose-apple
Copy link
Contributor

cc @mxswd

@mxswd
Copy link
Contributor

mxswd commented May 4, 2017

I will try to get a build with this change to evaluate the difference in peak memory usage before merging.

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but let's see what Maxwell finds

@mxswd
Copy link
Contributor

mxswd commented May 4, 2017

I've double checked and it looks great to me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants