{"action":"created","issue":{"url":"https://api.github.com/repos/deeplearning4j/nd4j/issues/1220","repository_url":"https://api.github.com/repos/deeplearning4j/nd4j","labels_url":"https://api.github.com/repos/deeplearning4j/nd4j/issues/1220/labels{/name}","comments_url":"https://api.github.com/repos/deeplearning4j/nd4j/issues/1220/comments","events_url":"https://api.github.com/repos/deeplearning4j/nd4j/issues/1220/events","html_url":"https://github.com/deeplearning4j/nd4j/issues/1220","id":171275123,"number":1220,"title":"nd4j-native gc issue","user":{"login":"raver119","id":12250879,"avatar_url":"https://avatars.githubusercontent.com/u/12250879?v=3","gravatar_id":"","url":"https://api.github.com/users/raver119","html_url":"https://github.com/raver119","followers_url":"https://api.github.com/users/raver119/followers","following_url":"https://api.github.com/users/raver119/following{/other_user}","gists_url":"https://api.github.com/users/raver119/gists{/gist_id}","starred_url":"https://api.github.com/users/raver119/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raver119/subscriptions","organizations_url":"https://api.github.com/users/raver119/orgs","repos_url":"https://api.github.com/users/raver119/repos","events_url":"https://api.github.com/users/raver119/events{/privacy}","received_events_url":"https://api.github.com/users/raver119/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-08-15T22:18:23Z","updated_at":"2016-08-16T07:39:32Z","closed_at":null,"body":"Ruben reported growing memory footprints while using nd4j-native.\r\n\r\nCode that reproduces behavior as follows:\r\n\r\n```\r\nfor (int i = 0; i < RUN_LIMIT; i++) {\r\n            INDArray arrays[] = new INDArray[4];\r\n            for (int x = 0; x< 4; x++) \r\n                arrays[x] = Nd4j.rand(new int[]{1, 100, 100});\r\n    \r\n            INDArray result = Nd4j.concat(0, arrays);\r\n            result.muli(1/256f);\r\n\r\n            if (i % 500 == 0) {\r\n                System.out.println(\"Iteration \" + i + \" passed, Mem: \" + (Pointer.totalBytes() / 1024 / 1024));\r\n            }\r\n        }\r\n```\r\n\r\nEven with using -XX:+UseConcMarkSweepGC i definitely see memory being released on irregular basis, tending to go as close to -Xmx value, as possible. And in most of times after forced gc (using jvisualvm/yourkit) memory isn't released properly, but tends to stay around 100-300MB. However, sometime it goes down to 5-7 mb.\r\n\r\nThe same code on cuda backend doesn't produce anything special, memory use stays flat after few first iterations.\r\n\r\nHere's gist of output produced with nd4j-native: https://gist.github.com/raver119/87e83492d9e12cdaa279fe38dc85cfb4"},"comment":{"url":"https://api.github.com/repos/deeplearning4j/nd4j/issues/comments/240026589","html_url":"https://github.com/deeplearning4j/nd4j/issues/1220#issuecomment-240026589","issue_url":"https://api.github.com/repos/deeplearning4j/nd4j/issues/1220","id":240026589,"user":{"login":"raver119","id":12250879,"avatar_url":"https://avatars.githubusercontent.com/u/12250879?v=3","gravatar_id":"","url":"https://api.github.com/users/raver119","html_url":"https://github.com/raver119","followers_url":"https://api.github.com/users/raver119/followers","following_url":"https://api.github.com/users/raver119/following{/other_user}","gists_url":"https://api.github.com/users/raver119/gists{/gist_id}","starred_url":"https://api.github.com/users/raver119/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raver119/subscriptions","organizations_url":"https://api.github.com/users/raver119/orgs","repos_url":"https://api.github.com/users/raver119/repos","events_url":"https://api.github.com/users/raver119/events{/privacy}","received_events_url":"https://api.github.com/users/raver119/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T07:39:32Z","updated_at":"2016-08-16T07:39:32Z","body":"Guys,  in our case - there's no need for anything special. Memory is being used in equal chunks for us, since memory shapes are always equal. So the most primitive cache technique is the best solution for our case. If on iteration 1 memory shape of 100x100 was requested - it'll be also requested in all subsequent iterations. So we should just exploit this."}}
{"actor":{"display_login":"raver119"}}