File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1482,6 +1482,9 @@ class Solution {
14821482 // / The fixed score for this solution.
14831483 Score FixedScore;
14841484
1485+ // / The total memory used by this solution.
1486+ std::optional<size_t > TotalMemory;
1487+
14851488public:
14861489 // / Create a solution for the given constraint system.
14871490 Solution (ConstraintSystem &cs, const Score &score)
Original file line number Diff line number Diff line change @@ -1863,7 +1863,11 @@ static inline size_t size_in_bytes(const T &x) {
18631863}
18641864
18651865size_t Solution::getTotalMemory () const {
1866- return sizeof (*this ) + typeBindings.getMemorySize () +
1866+ if (TotalMemory)
1867+ return *TotalMemory;
1868+
1869+ const_cast <Solution *>(this )->TotalMemory
1870+ = sizeof (*this ) + typeBindings.getMemorySize () +
18671871 overloadChoices.getMemorySize () +
18681872 ConstraintRestrictions.getMemorySize () +
18691873 (Fixes.size () * sizeof (void *)) + DisjunctionChoices.getMemorySize () +
@@ -1887,6 +1891,8 @@ size_t Solution::getTotalMemory() const {
18871891 size_in_bytes (argumentLists) +
18881892 size_in_bytes (ImplicitCallAsFunctionRoots) +
18891893 size_in_bytes (SynthesizedConformances);
1894+
1895+ return *TotalMemory;
18901896}
18911897
18921898DeclContext *Solution::getDC () const { return constraintSystem->DC ; }
You can’t perform that action at this time.
0 commit comments