{"action":"closed","issue":{"url":"https://api.github.com/repos/pixijs/pixi.js/issues/2327","repository_url":"https://api.github.com/repos/pixijs/pixi.js","labels_url":"https://api.github.com/repos/pixijs/pixi.js/issues/2327/labels{/name}","comments_url":"https://api.github.com/repos/pixijs/pixi.js/issues/2327/comments","events_url":"https://api.github.com/repos/pixijs/pixi.js/issues/2327/events","html_url":"https://github.com/pixijs/pixi.js/issues/2327","id":129416348,"number":2327,"title":"Memoryleaking in generateTexture?","user":{"login":"boymaas","id":300333,"avatar_url":"https://avatars.githubusercontent.com/u/300333?v=3","gravatar_id":"","url":"https://api.github.com/users/boymaas","html_url":"https://github.com/boymaas","followers_url":"https://api.github.com/users/boymaas/followers","following_url":"https://api.github.com/users/boymaas/following{/other_user}","gists_url":"https://api.github.com/users/boymaas/gists{/gist_id}","starred_url":"https://api.github.com/users/boymaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boymaas/subscriptions","organizations_url":"https://api.github.com/users/boymaas/orgs","repos_url":"https://api.github.com/users/boymaas/repos","events_url":"https://api.github.com/users/boymaas/events{/privacy}","received_events_url":"https://api.github.com/users/boymaas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-28T10:52:41Z","updated_at":"2016-02-28T22:23:07Z","closed_at":"2016-02-28T22:23:07Z","body":"We encountered an interesting case where we noticed increasing memory usages. We are \"pre-rendering\" complex structures using generateTexture and noticing an increase in memory usage per \"pre-render\".\r\n\r\nInvestigating the problem, we saw in the chrome heap snapshots the following:\r\n![image](https://cloud.githubusercontent.com/assets/300333/12641420/b7dc9ce0-c5af-11e5-9711-a8c469a64a4d.png)\r\n\r\nLooking at the code we found:\r\nhttps://github.com/pixijs/pixi.js/blob/5d385885324e97369fd29b686e9e90eb4cefd14a/src/core/graphics/Graphics.js#L702\r\n\r\nwhich creates an CanvasBuffer which doest the following:\r\nhttps://github.com/pixijs/pixi.js/blob/5d385885324e97369fd29b686e9e90eb4cefd14a/src/core/renderers/canvas/utils/CanvasBuffer.js#L16\r\n\r\nThis seams introduce per generateTexture call a static element to which the \"pre-rendered\" stays allocated. As can be seen in the heap snapshot. \r\n\r\nI was not aware of this, and its not by my knowledge in the documentation. This could lead to unexpected problems as CanvasBuffer is used internally and there is no way to release it as a caller.\r\n\r\nWe tried to pinpoint it down, it may have something to do with:\r\n this.canvas = document.createElement('canvas');\r\nbut I cannot tell this for sure. We really isolated the memory leak to the generateTexture call so somehting is there. We are using PIXI 3.0.7, any help or insight would be appreciated.\r\n\r\nGreat work with PIXI, we enjoy using it every day!\r\n\r\n-Boy\r\n"}}