{
  "id": 207532,
  "title": "Questions about Garbage collection mechanism in Python",
  "url": "/competitions/riiid-test-answer-prediction/discussion/207532",
  "author_name": "",
  "post_date": "2020-12-30T06:20:33.053873600Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>When I use <strong>del</strong> xxx with gc.collect(), the usage of RAM is not totally released. There would be  still something left while variable xxx is deleted. <br>\nCould anyone give me an explanation?  Thanks a lot :)</p>",
  "messages": [
    {
      "id": "1132050",
      "postDate": "12/30/2020 06:20:33",
      "content": "<p>When I use <strong>del</strong> xxx with gc.collect(), the usage of RAM is not totally released. There would be  still something left while variable xxx is deleted. <br>\nCould anyone give me an explanation?  Thanks a lot :)</p>",
      "rawMarkdown": "When I use **del** xxx with gc.collect(), the usage of RAM is not totally released. There would be  still something left while variable xxx is deleted. \nCould anyone give me an explanation?  Thanks a lot :)",
      "votes": null
    },
    {
      "id": "1132320",
      "postDate": "12/30/2020 10:04:04",
      "content": "<p>It could be a Jupyter notebook issue. If you print for instance some heads to your screen references are added. You can remove these by doing %reset out, but that does not always work. I had this problem before. Removing all Notebook Out[]'s is likely solving your problem.</p>",
      "rawMarkdown": "It could be a Jupyter notebook issue. If you print for instance some heads to your screen references are added. You can remove these by doing %reset out, but that does not always work. I had this problem before. Removing all Notebook Out[]'s is likely solving your problem.",
      "votes": null
    },
    {
      "id": "1132437",
      "postDate": "12/30/2020 12:05:42",
      "content": "<p>As it was mentioned before, this is most likely a Jupyter notebook problem. For example, sometimes when I perform the next operation in my google colab sheet:</p>\n<ol>\n<li><em>upload a file to ram</em></li>\n<li><em>del + gc.collect()</em></li>\n</ol>\n<p>step 2 isn't releasing the ram if my uploaded file was more than N GB in size, but it releases ram successfully if I upload file with (N-1) GB size.</p>",
      "rawMarkdown": "As it was mentioned before, this is most likely a Jupyter notebook problem. For example, sometimes when I perform the next operation in my google colab sheet:\n1. *upload a file to ram*\n2. *del + gc.collect()*\n\nstep 2 isn't releasing the ram if my uploaded file was more than N GB in size, but it releases ram successfully if I upload file with (N-1) GB size.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1132320,
      "author_name": "erikbruin",
      "author_url": "",
      "post_date": "12/30/2020 10:04:04",
      "content": "<p>It could be a Jupyter notebook issue. If you print for instance some heads to your screen references are added. You can remove these by doing %reset out, but that does not always work. I had this problem before. Removing all Notebook Out[]'s is likely solving your problem.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1132437,
      "author_name": "avtobusbratiev",
      "author_url": "",
      "post_date": "12/30/2020 12:05:42",
      "content": "<p>As it was mentioned before, this is most likely a Jupyter notebook problem. For example, sometimes when I perform the next operation in my google colab sheet:</p>\n<ol>\n<li><em>upload a file to ram</em></li>\n<li><em>del + gc.collect()</em></li>\n</ol>\n<p>step 2 isn't releasing the ram if my uploaded file was more than N GB in size, but it releases ram successfully if I upload file with (N-1) GB size.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1132050": "When I use **del** xxx with gc.collect(), the usage of RAM is not totally released. There would be  still something left while variable xxx is deleted. \nCould anyone give me an explanation?  Thanks a lot :)",
    "1132320": "It could be a Jupyter notebook issue. If you print for instance some heads to your screen references are added. You can remove these by doing %reset out, but that does not always work. I had this problem before. Removing all Notebook Out[]'s is likely solving your problem.",
    "1132437": "As it was mentioned before, this is most likely a Jupyter notebook problem. For example, sometimes when I perform the next operation in my google colab sheet:\n1. *upload a file to ram*\n2. *del + gc.collect()*\n\nstep 2 isn't releasing the ram if my uploaded file was more than N GB in size, but it releases ram successfully if I upload file with (N-1) GB size."
  },
  "source": "meta"
}