File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ def test_manifest_cache_memory_growth(memory_catalog: InMemoryCatalog) -> None:
121121 # Memory growth includes ManifestFile objects, metadata, and other overhead
122122 # We expect about 5-10 KB per iteration for typical workloads
123123 # The key improvement is that growth is O(N) not O(N²)
124+ # Threshold of 15KB/iteration based on observed behavior - O(N²) would show ~50KB+/iteration
124125 assert growth_per_iteration < 15000 , (
125126 f"Memory growth per iteration ({ growth_per_iteration :.0f} bytes) is too high. "
126127 "This may indicate the O(N²) cache inefficiency is present."
@@ -168,6 +169,10 @@ def test_memory_after_gc_with_cache_cleared(memory_catalog: InMemoryCatalog) ->
168169 print ("\n Results:" )
169170 print (f" Memory reclaimed by clearing cache: { memory_reclaimed / 1024 :.1f} KB" )
170171
172+ # Verify that clearing the cache actually freed some memory
173+ # Note: This may be flaky in some environments due to GC behavior
174+ assert memory_reclaimed >= 0 , "Memory should not increase after clearing cache"
175+
171176
172177@pytest .mark .benchmark
173178def test_manifest_cache_deduplication_efficiency () -> None :
You can’t perform that action at this time.
0 commit comments