diff --git a/YGMarker.h b/YGMarker.h index 60de512..63f2c40 100644 --- a/YGMarker.h +++ b/YGMarker.h @@ -20,6 +20,7 @@ typedef YG_ENUM_BEGIN(YGMarker){ typedef struct { int layouts; int measures; + int maxMeasureCache; int cachedLayouts; int cachedMeasures; } YGMarkerLayoutData; diff --git a/Yoga.cpp b/Yoga.cpp index 9ae1640..0d576d5 100644 --- a/Yoga.cpp +++ b/Yoga.cpp @@ -3889,6 +3889,11 @@ bool YGLayoutNodeInternal( layout->lastOwnerDirection = ownerDirection; if (cachedResults == nullptr) { + if (layout->nextCachedMeasurementsIndex + 1 > + (uint32_t) layoutMarkerData.maxMeasureCache) { + layoutMarkerData.maxMeasureCache = + layout->nextCachedMeasurementsIndex + 1; + } if (layout->nextCachedMeasurementsIndex == YG_MAX_CACHED_RESULT_COUNT) { if (gPrintChanges) { YGLog(node, YGLogLevelVerbose, "Out of cache entries!\n");