{"id": 472097220, "node_id": "MDU6SXNzdWU0NzIwOTcyMjA=", "number": 7, "title": "Script uses a lot of RAM", "user": {"value": 9599, "label": "simonw"}, "state": "closed", "locked": 0, "assignee": null, "milestone": null, "comments": 3, "created_at": "2019-07-24T06:11:11Z", "updated_at": "2019-07-24T06:35:52Z", "closed_at": "2019-07-24T06:35:52Z", "author_association": "MEMBER", "pull_request": null, "body": "I'm using an XML pull parser which should avoid the need to slurp the whole XML file into memory, but it's not working - the script still uses over 1GB of RAM when it runs according to Activity Monitor.\r\n\r\nI think this is because I'm still causing the full root element to be incrementally loaded into memory just in case I try and access it later.\r\n\r\nhttp://effbot.org/elementtree/iterparse.htm says I should use `elem.clear()` as I go. It also says:\r\n\r\n> The above pattern has one drawback; it does not clear the root element, so you will end up with a single element with lots of empty child elements. If your files are huge, rather than just large, this might be a problem. To work around this, you need to get your hands on the root element.\r\n\r\nSo I will try that recipe and see if it helps.", "repo": {"value": 197882382, "label": "healthkit-to-sqlite"}, "type": "issue", "active_lock_reason": null, "performed_via_github_app": null, "reactions": "{\"url\": \"https://api.github.com/repos/dogsheep/healthkit-to-sqlite/issues/7/reactions\", \"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "draft": null, "state_reason": "completed"}