{"action":"closed","issue":{"url":"https://api.github.com/repos/cognitect/transit-clj/issues/25","labels_url":"https://api.github.com/repos/cognitect/transit-clj/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/cognitect/transit-clj/issues/25/comments","events_url":"https://api.github.com/repos/cognitect/transit-clj/issues/25/events","html_url":"https://github.com/cognitect/transit-clj/issues/25","id":82432061,"number":25,"title":"Memory leak in version 0.8.271","user":{"login":"pjstadig","id":5656,"avatar_url":"https://avatars.githubusercontent.com/u/5656?v=3","gravatar_id":"","url":"https://api.github.com/users/pjstadig","html_url":"https://github.com/pjstadig","followers_url":"https://api.github.com/users/pjstadig/followers","following_url":"https://api.github.com/users/pjstadig/following{/other_user}","gists_url":"https://api.github.com/users/pjstadig/gists{/gist_id}","starred_url":"https://api.github.com/users/pjstadig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjstadig/subscriptions","organizations_url":"https://api.github.com/users/pjstadig/orgs","repos_url":"https://api.github.com/users/pjstadig/repos","events_url":"https://api.github.com/users/pjstadig/events{/privacy}","received_events_url":"https://api.github.com/users/pjstadig/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-29T13:39:21Z","updated_at":"2015-05-30T16:27:25Z","closed_at":"2015-05-30T16:27:25Z","body":"My co-worker (Tanya Romankova) and I have discovered a memory leak in version 0.8.271 of transit-clj. We were attempting to encode several million items with transit (each with a separate writer), and eventually got a GC overhead limit OOME. After examining the heap dump it became clear that the issue was transit-java's WriteHandler cache.\r\n\r\nEvery time a writer is created a new hash map of default handlers is also created by calling cognitect.transit/default-write-handlers. Since the values of the hash map that is generated are reified objects, they have identity equality semantics. This means that no two hash maps that come out of cognitect.transit/default-write-handlers are equal:\r\n\r\n```\r\n(not= (cognitect.transit/default-write-handlers) (cognitect.transit/default-write-handlers))\r\n=> true\r\n```\r\n\r\nThe result is that the WriteHandler cache in transit-java accrues a new entry every time you create a writer.\r\n\r\nWe've created a repository that demonstrates the memory leak. The README contains details about our diagnosis as well as sample output.\r\n\r\nhttps://github.com/pjstadig/transit-clj-0.8.271-memory-leak"}}