Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7191

Plotting in loop hangs matplotlib: strange memory leak?

$
0
0

I have a bunch of timestamp-value like pandas.DataFrame -s in a dict, like this:

dfS[k1] = df1dfS[k2] = df2...

While plotting to the same axis like this:

dfS[k1].plot(ax=ax1)dfS[k2].plot(ax=ax1)...

works, the same in a loop:

for k in dfS.keys():    dfS[k].plot(ax=ax1)

crashes matplotlib after about 20 secs with the message:

MemoryError: Unable to allocate 45.2 GiB for an array with shape (1617710138,) and data type [('val', '<i8'), ('maj', '?'), ('min', '?'), ('fmt', 'S20')]

Looks like matplotlib interprets a timestamp as a shape, since the totalnumber of datapoints is just 610

matplotlib.__version__'3.3.0'python3 --versionPython 3.8.6

Any suggestion?


Viewing all articles
Browse latest Browse all 7191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>