{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1045","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1045/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1045/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1045/events","html_url":"https://github.com/realm/realm-java/issues/1045","id":69130440,"number":1045,"title":"closeするタイミングについて","user":{"login":"cw-shigemura","id":11263514,"avatar_url":"https://avatars.githubusercontent.com/u/11263514?v=3","gravatar_id":"","url":"https://api.github.com/users/cw-shigemura","html_url":"https://github.com/cw-shigemura","followers_url":"https://api.github.com/users/cw-shigemura/followers","following_url":"https://api.github.com/users/cw-shigemura/following{/other_user}","gists_url":"https://api.github.com/users/cw-shigemura/gists{/gist_id}","starred_url":"https://api.github.com/users/cw-shigemura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cw-shigemura/subscriptions","organizations_url":"https://api.github.com/users/cw-shigemura/orgs","repos_url":"https://api.github.com/users/cw-shigemura/repos","events_url":"https://api.github.com/users/cw-shigemura/events{/privacy}","received_events_url":"https://api.github.com/users/cw-shigemura/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-04-17T12:33:09Z","updated_at":"2015-04-17T15:03:25Z","closed_at":null,"body":"はじめまして。\r\nChatWorkの重村と申します。\r\n\r\nRealmのcloseをするタイミングについて確認させてください。\r\n\r\nドキュメント上では、closeは一般的にonDestroyメソッドのタイミングでcloseメソッドを呼び出すように記載されています。\r\nhttp://realm.io/jp/docs/java/#realm-\r\n\r\nしかし、onDestroyメソッドはAndroidのFramework側が、メモリが足りなくなった場合などに\r\nonDestroyメソッドを呼び出さないことがあります。\r\n基本的にはonResumeメソッドでgetInstanceメソッドを呼び、onPauseメソッドでcloseするというのが正解ではないでしょうか？そうしないとメモリリークが発生するのではないかと思われます。\r\nもしくは、Realm側で自動でcloseしてくれる仕組みが入れば嬉しいかなと・・・\r\n\r\n一度ご確認いただけましたら幸いです。\r\nよろしくお願いいたします。"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/94003852","html_url":"https://github.com/realm/realm-java/issues/1045#issuecomment-94003852","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1045","id":94003852,"user":{"login":"cw-shigemura","id":11263514,"avatar_url":"https://avatars.githubusercontent.com/u/11263514?v=3","gravatar_id":"","url":"https://api.github.com/users/cw-shigemura","html_url":"https://github.com/cw-shigemura","followers_url":"https://api.github.com/users/cw-shigemura/followers","following_url":"https://api.github.com/users/cw-shigemura/following{/other_user}","gists_url":"https://api.github.com/users/cw-shigemura/gists{/gist_id}","starred_url":"https://api.github.com/users/cw-shigemura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cw-shigemura/subscriptions","organizations_url":"https://api.github.com/users/cw-shigemura/orgs","repos_url":"https://api.github.com/users/cw-shigemura/repos","events_url":"https://api.github.com/users/cw-shigemura/events{/privacy}","received_events_url":"https://api.github.com/users/cw-shigemura/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T15:03:25Z","updated_at":"2015-04-17T15:03:25Z","body":"勉強になりましたm(_ _)m @zaki50 \r\n私の理解が足りていなかったのがよくわかりました。\r\n\r\nThank you very much @emanuelez @kishikawakatsumi \r\nご回答いただき、誠にありがとうございました。\r\nRealmの実装をもっと読んで、理解を深めたいと思います。\r\n"}}