Skip to content

Commit

Permalink
Make sure memory threshold callback always fires at least once
Browse files Browse the repository at this point in the history
Summary:
If live==false the first time we notice memory exceeded the threshold,
we'll never trigger the callback.

Reviewed By: paulbiss

Differential Revision: D4824509

fbshipit-source-id: 795b905eda5d1ec8b13d78a549eb499bf3c415c2
  • Loading branch information
edwinsmith authored and hhvm-bot committed Apr 15, 2017
1 parent 7fc46d3 commit be2968c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hphp/runtime/base/memory-manager.cpp
Expand Up @@ -410,9 +410,8 @@ void MemoryManager::refreshStatsImpl(MemoryUsageStats& stats) {
refreshStatsHelperStop();
}
#endif
if (live &&
stats.usage() > m_memThresholdCallbackPeakUsage &&
stats.peakUsage <= m_memThresholdCallbackPeakUsage) {
if (live && stats.usage() > m_memThresholdCallbackPeakUsage) {
m_memThresholdCallbackPeakUsage = SIZE_MAX;
setSurpriseFlag(MemThresholdFlag);
}

Expand Down

0 comments on commit be2968c

Please sign in to comment.