Closed karponi closed 5 months ago
I cannot reproduce memory leak unless I intentionally create one by holding a ref to returned data frame. Code I used attached.
without leak:
Filename: issue_548.py
Line # Mem usage Increment Occurrences Line Contents
=============================================================
43 74.5 MiB 74.5 MiB 1 @profile
44 def run(api) -> int:
45 74.5 MiB 0.0 MiB 1 n = 0
46 77.3 MiB 2.8 MiB 1 n += _retrieve_influx_data(query_api)
47 77.4 MiB 0.1 MiB 1 n += _retrieve_influx_data(query_api)
48 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
49 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
50 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
51 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
52 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
53 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
54 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
55 77.4 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
56 77.4 MiB 0.0 MiB 1 return n
with intentional leak (--leak
):
Filename: issue_548.py
Line # Mem usage Increment Occurrences Line Contents
=============================================================
43 74.5 MiB 74.5 MiB 1 @profile
44 def run(api) -> int:
45 74.5 MiB 0.0 MiB 1 n = 0
46 77.8 MiB 3.3 MiB 1 n += _retrieve_influx_data(query_api)
47 77.8 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
48 78.1 MiB 0.3 MiB 1 n += _retrieve_influx_data(query_api)
49 78.3 MiB 0.3 MiB 1 n += _retrieve_influx_data(query_api)
50 78.4 MiB 0.1 MiB 1 n += _retrieve_influx_data(query_api)
51 78.7 MiB 0.3 MiB 1 n += _retrieve_influx_data(query_api)
52 78.7 MiB 0.1 MiB 1 n += _retrieve_influx_data(query_api)
53 79.0 MiB 0.2 MiB 1 n += _retrieve_influx_data(query_api)
54 79.1 MiB 0.1 MiB 1 n += _retrieve_influx_data(query_api)
55 79.1 MiB 0.0 MiB 1 n += _retrieve_influx_data(query_api)
56 79.1 MiB 0.0 MiB 1 return n
Could not reproduce.
Specifications
Code sample to reproduce problem
Expected behavior
The memory should not increase at every call of query_influx
Actual behavior
The memory is being increased at every call, leading to crashes
Additional info
here's the output of the memory_profiler: