@@ -378,6 +378,9 @@ func TestTarGzMemoryConsumption(t *testing.T) {
378
378
379
379
runtime .ReadMemStats (& m2 )
380
380
heapUsed := m2 .HeapInuse - m .HeapInuse
381
+ if m2 .HeapInuse < m .HeapInuse {
382
+ heapUsed = 0
383
+ }
381
384
fmt .Println ("Heap memory used during the test:" , heapUsed )
382
385
require .True (t , heapUsed < 5000000 , "heap consumption should be less than 5M but is %d" , heapUsed )
383
386
}
@@ -403,10 +406,13 @@ func TestZipMemoryConsumption(t *testing.T) {
403
406
404
407
runtime .ReadMemStats (& m2 )
405
408
heapUsed := m2 .HeapInuse - m .HeapInuse
409
+ if m2 .HeapInuse < m .HeapInuse {
410
+ heapUsed = 0
411
+ }
406
412
fmt .Println ("Heap memory used during the test:" , heapUsed )
407
413
// the .zip file require random access, so the full io.Reader content must be cached, since
408
- // the test file is 130MB, that's the reason for the 180+ Mb of memory consumed.
409
- require .True (t , heapUsed < 200000000 , "heap consumption should be less than 200M but is %d" , heapUsed )
414
+ // the test file is 130MB, that's the reason for the high memory consumed.
415
+ require .True (t , heapUsed < 250000000 , "heap consumption should be less than 250M but is %d" , heapUsed )
410
416
}
411
417
412
418
func download (t require.TestingT , url string , file * paths.Path ) error {
0 commit comments