-
Notifications
You must be signed in to change notification settings - Fork 133
Conversation
- Fix issue microsoft#109: Reloading modules leaks memory - Fix issue microsoft#278: Huge memory usage when analysis 9 lines python code - Some code clean-up
I can confirm that this fixes #278. Nice! |
@@ -22,16 +22,14 @@ namespace Microsoft.PythonTools.Parsing.Ast { | |||
public class DottedName : Node { | |||
private readonly NameExpression[] _names; | |||
|
|||
public DottedName(NameExpression[] names) { | |||
public DottedName(NameExpression[]/*!*/ names) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the meaning of /*!*/
introduced in a few of these files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment that I've used to mark parameter that can't be null. I can add Check
calls instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to change it, I just hadn't seen that before and was curious. Grepping through the project shows its use a number of other times as well (so I just hadn't noticed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear - this is just a comment. It isn't handled by any analyzers. I really expect to see non-nullable reference types in C# 8: https://github.com/dotnet/csharplang/wiki/Nullable-Reference-Types-Preview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I know. I actually went searching to see if that feature existed yet when you mentioned it. 🙂
} | ||
|
||
public void ClearReferencedModules() { | ||
foreach (var moduleReference in _referencedModules.Values.Distinct()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if Values can be null (when module is missing) - perhaps MaybeEnumerate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_referencedModules
is a dictionary, it is always initialized and it is readonly.
…-server into Fix95 # Conflicts: # src/Analysis/Engine/Test/CompletionTest.cs
Several bug fixes
from ... import
shows incorrect completions #95:from ... import
shows incorrect completions.TryGetCompletionsInFromImport
didn't use information fromModuleInfo._referencedModules
, trying to find module directly inside AST.ModuleInfo.Clear
didn't remove back references fromModuleReference
instancesDocumentSymbol
tree.Server.ToDocumentSymbols
usesDictionary<IMemberResult, List<IMemberResult>>
to make a tree, andMemberResult
'sGetHashCode
andEquals
didn't take care of the scope. As a result, all results with equal parent name were collapsed into one level, which created a loop in a resulting tree where Json.Net has been hanging.