Title: [Bug]: GPU memory leak with plt.figure() · Issue #22448 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: GPU memory leak with plt.figure() · Issue #22448 · matplotlib/matplotlib
X Title: [Bug]: GPU memory leak with plt.figure() · Issue #22448 · matplotlib/matplotlib
Description: Bug summary There seems to be a GPU memory leak when calling plt.figure() and plt.close() repeatedly in matplotlib version 3.5.0. Every time these two lines are ran, more and more GPU memory gets hogged up. Code for reproduction from mat...
Open Graph Description: Bug summary There seems to be a GPU memory leak when calling plt.figure() and plt.close() repeatedly in matplotlib version 3.5.0. Every time these two lines are ran, more and more GPU memory gets h...
X Description: Bug summary There seems to be a GPU memory leak when calling plt.figure() and plt.close() repeatedly in matplotlib version 3.5.0. Every time these two lines are ran, more and more GPU memory gets h...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/22448
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: GPU memory leak with plt.figure()","articleBody":"### Bug summary\n\nThere seems to be a GPU memory leak when calling `plt.figure()` and `plt.close()` repeatedly in matplotlib version `3.5.0`. Every time these two lines are ran, more and more GPU memory gets hogged up.\n\n### Code for reproduction\n\n```python\nfrom matplotlib import pyplot as plt\r\n\r\nfor i in range(10000):\r\n plt.figure()\r\n plt.close()\n```\n\n\n### Actual outcome\n\nWhen inspecting memory usage, more and more GPU memory gets hogged up. Specifically, I ran `nvidia-smi -l 1` and observed Memory-Usage increasing until it hits the GPU memory limits, which is when the process crashes.\n\n### Expected outcome\n\nGPU memory usage should not be going up every iteration of this for loop.\n\n### Additional information\n\nThis is an issue in matplotlib version `3.5.0`, but not `3.0.3`.\n\n### Operating system\n\nUbuntu\n\n### Matplotlib Version\n\n3.5.0\n\n### Matplotlib Backend\n\nTkAgg\n\n### Python version\n\n3.9.10\n\n### Jupyter version\n\n6.4.8\n\n### Installation\n\npip","author":{"url":"https://github.com/patrickhaoy","@type":"Person","name":"patrickhaoy"},"datePublished":"2022-02-11T00:45:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/22448/matplotlib/issues/22448"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d164af2a-fda1-d68f-093a-e1b005a6ae9a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B48A:126BF:379683:391A1C:6A519A51 |
| html-safe-nonce | 3c139cc7b6702958d78b41984aebf9803b8083c5025fe0805c8faf4f31d299db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDhBOjEyNkJGOjM3OTY4MzozOTFBMUM6NkE1MTlBNTEiLCJ2aXNpdG9yX2lkIjoiNzg0MDY1NDQ1OTI1MjM0OTUyMSIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 4b1445b7a32bc60104fe6615c03619372b1dce726f7f2b3a1c5f093721af9bb5 |
| hovercard-subject-tag | issue:1131354710 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/22448/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0643ba2c2681303aa7369feb98a9ef5545d24240abd0fabf537956a6860b3d8e/matplotlib/matplotlib/issues/22448 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0643ba2c2681303aa7369feb98a9ef5545d24240abd0fabf537956a6860b3d8e/matplotlib/matplotlib/issues/22448 |
| og:image:alt | Bug summary There seems to be a GPU memory leak when calling plt.figure() and plt.close() repeatedly in matplotlib version 3.5.0. Every time these two lines are ran, more and more GPU memory gets h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | patrickhaoy |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width