{"action":"created","issue":{"url":"https://api.github.com/repos/raspberrypi/firmware/issues/534","repository_url":"https://api.github.com/repos/raspberrypi/firmware","labels_url":"https://api.github.com/repos/raspberrypi/firmware/issues/534/labels{/name}","comments_url":"https://api.github.com/repos/raspberrypi/firmware/issues/534/comments","events_url":"https://api.github.com/repos/raspberrypi/firmware/issues/534/events","html_url":"https://github.com/raspberrypi/firmware/issues/534","id":130748946,"number":534,"title":"Proper cleanup of resources in hello_triangle","user":{"login":"carlonluca","id":3678828,"avatar_url":"https://avatars.githubusercontent.com/u/3678828?v=3","gravatar_id":"","url":"https://api.github.com/users/carlonluca","html_url":"https://github.com/carlonluca","followers_url":"https://api.github.com/users/carlonluca/followers","following_url":"https://api.github.com/users/carlonluca/following{/other_user}","gists_url":"https://api.github.com/users/carlonluca/gists{/gist_id}","starred_url":"https://api.github.com/users/carlonluca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlonluca/subscriptions","organizations_url":"https://api.github.com/users/carlonluca/orgs","repos_url":"https://api.github.com/users/carlonluca/repos","events_url":"https://api.github.com/users/carlonluca/events{/privacy}","received_events_url":"https://api.github.com/users/carlonluca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-02T17:09:25Z","updated_at":"2016-02-20T15:32:06Z","closed_at":null,"body":"For an open project I'm implementing a code that creates and destroys EGL surfaces and contexts to create OpenGL textures in background threads. Everything works properly until this creation/destruction is iterated for days (which means thousands of times). In that case I get many types of errors, but typically EGL_BAD_PARAMETER from EGL. After that I need to restart my app. I therefore tried to reproduce with the hello_triangle example, and placed the main function (which I see includes the cleanup procedure) in a loop. After a thousand iterations it fails. This time the error seems to come from somewhere else.\r\n\r\nAs this example does something pretty similar to what I do, would it be possible for you to check why it is not looping forever? I suppose if everything is properly disposed it should loop endlessly. My hope is that making this work may help me fix my code.\r\n\r\nThe code I'm attaching here is similar, it just adds glDeleteTextures for the texture IDs, a couple of calls that I tried to place to close the dispmanx window and the bcm_host_deinit() to compensate the bcm_host_init() call. Unfortunately still it fails creating the EGL surface after exactly 1024 iterations with the error EGL_BAD_NATIVE_WINDOW, so I guess something is still not released properly. Any idea what?\r\n\r\nThank you!\r\n\r\n[triangle.c.zip](https://github.com/raspberrypi/firmware/files/114316/triangle.c.zip)"},"comment":{"url":"https://api.github.com/repos/raspberrypi/firmware/issues/comments/186627671","html_url":"https://github.com/raspberrypi/firmware/issues/534#issuecomment-186627671","issue_url":"https://api.github.com/repos/raspberrypi/firmware/issues/534","id":186627671,"user":{"login":"carlonluca","id":3678828,"avatar_url":"https://avatars.githubusercontent.com/u/3678828?v=3","gravatar_id":"","url":"https://api.github.com/users/carlonluca","html_url":"https://github.com/carlonluca","followers_url":"https://api.github.com/users/carlonluca/followers","following_url":"https://api.github.com/users/carlonluca/following{/other_user}","gists_url":"https://api.github.com/users/carlonluca/gists{/gist_id}","starred_url":"https://api.github.com/users/carlonluca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlonluca/subscriptions","organizations_url":"https://api.github.com/users/carlonluca/orgs","repos_url":"https://api.github.com/users/carlonluca/repos","events_url":"https://api.github.com/users/carlonluca/events{/privacy}","received_events_url":"https://api.github.com/users/carlonluca/received_events","type":"User","site_admin":false},"created_at":"2016-02-20T15:32:06Z","updated_at":"2016-02-20T15:32:06Z","body":"Yes of course. Everything seems to be working properly."}}