From: Mike Bayer Date: Tue, 8 Aug 2017 18:02:16 +0000 (-0400) Subject: - allow the shrink phase for memusage to go until zeroed, X-Git-Tag: origin~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a23654649e9b121001b24213bfa946409774e55;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - allow the shrink phase for memusage to go until zeroed, some MySQL-env element is causing memory growth that goes very far before stopping Change-Id: Ic0882dd78636067980fceba4e3a969de78d5b26a --- diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py index 4a378d77dd..771f376fc0 100644 --- a/test/aaa_profiling/test_memusage.py +++ b/test/aaa_profiling/test_memusage.py @@ -58,7 +58,10 @@ def profile_memory(maxtimes=250, max_ = 0 max_grew_for = 0 success = False - for y in range(maxtimes // 5): + until_maxtimes = 0 + while True: + if until_maxtimes >= maxtimes // 5: + break for x in range(5): func(*args) gc_collect() @@ -82,6 +85,7 @@ def profile_memory(maxtimes=250, ) max_ = latest_max max_grew_for += 1 + until_maxtimes += 1 continue else: print("Max remained at %s, %s more attempts left" % @@ -90,8 +94,13 @@ def profile_memory(maxtimes=250, if max_grew_for == 0: success = True break - else: - assert False, repr(samples) + + if not success: + assert False, \ + "Ran for a total of %d times, memory kept growing: %r" % ( + maxtimes, + samples + ) assert success return profile