Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Memory leak in function matplotlib._path.affine_transform #20641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Stardust1225 opened this issue Jul 13, 2021 · 0 comments · Fixed by #20645
Closed

Memory leak in function matplotlib._path.affine_transform #20641

Stardust1225 opened this issue Jul 13, 2021 · 0 comments · Fixed by #20645

Comments

@Stardust1225
Copy link

Bug report

When I input an illegal value into the function matplotlib._path.affine_transform, the memory use is increasing as the number of calls.

Code for reproduction

import sys
import tracemalloc
import numpy
import matplotlib._path

arg_list = []
arg_list.append(True)
arg_list.append(True)
arg_list.append(False)
arg_list.append(False)
arg_list.append(False)
arg_list.append(False)
arg_list.append(False)
arg_list.append(False)
arg_list.append(False)

memory_recorder = []
tracemalloc.start()
start_snapshot = tracemalloc.take_snapshot()
for i in range(0, 100):
  try:
    matplotlib._path.affine_transform([], numpy.array(
      [[arg_list[0], arg_list[1], arg_list[2]], [arg_list[3], arg_list[4], arg_list[5]],
       [arg_list[6], arg_list[7], arg_list[8]]]))
  except:
    pass
  if i % 10 == 0:
    one_snapshot = tracemalloc.take_snapshot()
    memory_recorder.append(one_snapshot.compare_to(start_snapshot, 'lineno')[0])

for i in range(2, len(memory_recorder)):
  print(memory_recorder[i].traceback)
  print(memory_recorder[i].size)

tracemalloc.stop()

Actual outcome

test.py:22
2497
test.py:22
3617
test.py:22
4737
test.py:22
5809
test.py:22
6977
test.py:22
8049
test.py:22
9217
test.py:22
10337

As the output shows, the memory use of line 22 is increasing as the number of calls increases.

I install matplotlib from source code via command pip3 install -e .
and the version is commit 9e0bb9c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant