{"action":"created","issue":{"url":"https://api.github.com/repos/zwopple/PocketSocket/issues/24","repository_url":"https://api.github.com/repos/zwopple/PocketSocket","labels_url":"https://api.github.com/repos/zwopple/PocketSocket/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/zwopple/PocketSocket/issues/24/comments","events_url":"https://api.github.com/repos/zwopple/PocketSocket/issues/24/events","html_url":"https://github.com/zwopple/PocketSocket/issues/24","id":55433707,"number":24,"title":"Retain cycle in PSWebSocketServer?","user":{"login":"paulshapiro","id":438826,"avatar_url":"https://avatars.githubusercontent.com/u/438826?v=3","gravatar_id":"","url":"https://api.github.com/users/paulshapiro","html_url":"https://github.com/paulshapiro","followers_url":"https://api.github.com/users/paulshapiro/followers","following_url":"https://api.github.com/users/paulshapiro/following{/other_user}","gists_url":"https://api.github.com/users/paulshapiro/gists{/gist_id}","starred_url":"https://api.github.com/users/paulshapiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulshapiro/subscriptions","organizations_url":"https://api.github.com/users/paulshapiro/orgs","repos_url":"https://api.github.com/users/paulshapiro/repos","events_url":"https://api.github.com/users/paulshapiro/events{/privacy}","received_events_url":"https://api.github.com/users/paulshapiro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-25T22:45:48Z","updated_at":"2016-03-19T17:57:51Z","closed_at":"2016-03-19T17:57:51Z","body":"Hello there,\r\n\r\nFirst, thanks for the fantastic library. \r\n\r\nI just found out that an NSAssert in a block somewhere in my application was causing a retain cycle. I was like, \"huh?\", so I checked out the definition of NSAssert, and sure enough, it references 'self':\r\n\r\n    #define NSAssert(condition, desc, ...) \\\r\n        do { \\\r\n    __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \\\r\n    if (!(condition)) { \\\r\n        [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \\\r\n    object:self file:[NSString stringWithUTF8String:__FILE__] \\\r\n        lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \\\r\n    } \\\r\n            __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \\\r\n        } while(0)\r\n    #endif\r\n\r\nAnyway, I start searching through the application codebase, and, having included the source of PocketSocket directly in the project, I happened upon an NSAssert within a block within PSWebSocketServer around line 518. I thought you might want to know. Theoretically, it could be causing you to have to release PSWebSocketServer one too many times in order to get apparent proper dealloc behavior.\r\n\r\nHowever, just a heads up, I have not confirmed that this is indeed happening or causing problems in PocketSocket.\r\n\r\nThanks,\r\nPaul"},"comment":{"url":"https://api.github.com/repos/zwopple/PocketSocket/issues/comments/198758890","html_url":"https://github.com/zwopple/PocketSocket/issues/24#issuecomment-198758890","issue_url":"https://api.github.com/repos/zwopple/PocketSocket/issues/24","id":198758890,"user":{"login":"robertjpayne","id":214288,"avatar_url":"https://avatars.githubusercontent.com/u/214288?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjpayne","html_url":"https://github.com/robertjpayne","followers_url":"https://api.github.com/users/robertjpayne/followers","following_url":"https://api.github.com/users/robertjpayne/following{/other_user}","gists_url":"https://api.github.com/users/robertjpayne/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjpayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjpayne/subscriptions","organizations_url":"https://api.github.com/users/robertjpayne/orgs","repos_url":"https://api.github.com/users/robertjpayne/repos","events_url":"https://api.github.com/users/robertjpayne/events{/privacy}","received_events_url":"https://api.github.com/users/robertjpayne/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T17:57:51Z","updated_at":"2016-03-19T17:57:51Z","body":"@paulshapiro I'm not sure this is actually causing a retain cycle, because while the block does strongly hold onto \"self\" because of the assert the block is not retained by self once it finishes execution."}}