Count constraint-solving memory more precisely, rdar://29684330

This commit is contained in:
Graydon Hoare
2017-01-27 01:38:27 -08:00
parent c36b5373b3
commit 9cb1c52fd8
8 changed files with 61 additions and 9 deletions

View File

@@ -1650,3 +1650,16 @@ Type Solution::simplifyType(Type type) const {
return known->second;
});
}
size_t Solution::getTotalMemory() const {
return sizeof(*this) +
typeBindings.getMemorySize() +
overloadChoices.getMemorySize() +
ConstraintRestrictions.getMemorySize() +
llvm::capacity_in_bytes(Fixes) +
DisjunctionChoices.getMemorySize() +
OpenedTypes.getMemorySize() +
OpenedExistentialTypes.getMemorySize() +
(DefaultedConstraints.size() * sizeof(void*));
}