{"action":"created","issue":{"url":"https://api.github.com/repos/pinterest/PINCache/issues/77","repository_url":"https://api.github.com/repos/pinterest/PINCache","labels_url":"https://api.github.com/repos/pinterest/PINCache/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/pinterest/PINCache/issues/77/comments","events_url":"https://api.github.com/repos/pinterest/PINCache/issues/77/events","html_url":"https://github.com/pinterest/PINCache/issues/77","id":144006405,"number":77,"title":"costLimit not preventing very large in memory cache size","user":{"login":"dmauro","id":473366,"avatar_url":"https://avatars.githubusercontent.com/u/473366?v=3","gravatar_id":"","url":"https://api.github.com/users/dmauro","html_url":"https://github.com/dmauro","followers_url":"https://api.github.com/users/dmauro/followers","following_url":"https://api.github.com/users/dmauro/following{/other_user}","gists_url":"https://api.github.com/users/dmauro/gists{/gist_id}","starred_url":"https://api.github.com/users/dmauro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmauro/subscriptions","organizations_url":"https://api.github.com/users/dmauro/orgs","repos_url":"https://api.github.com/users/dmauro/repos","events_url":"https://api.github.com/users/dmauro/events{/privacy}","received_events_url":"https://api.github.com/users/dmauro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-03-28T15:38:56Z","updated_at":"2016-07-21T17:08:07Z","closed_at":"2016-07-21T17:08:07Z","body":"We're using PINRemoteImage and asking it to download several very large images (~5k x 4k). When it does this memory spikes up to 1GB and the app gets killed by the system. This seems to be the case even if we set our costLimit to something far below 1GB:\r\n\r\n```\r\n    var imagePrefetcher: PINRemoteImageManager = {\r\n        let manager = PINRemoteImageManager.sharedImageManager()\r\n        manager.cache.diskCache.byteLimit = 20_000_000\r\n        manager.cache.memoryCache.costLimit = 300_000_000\r\n        return manager\r\n    }()\r\n```\r\n\r\nIt seems like perhaps the costLimit is simply not being honored? Or is it possible these are ending up in memory somewhere else first?\r\n\r\nWe're making the download calls serially all on the main thread:\r\n```\r\n        for image in imagesToCache {\r\n            imagePrefetcher.downloadImageWithURL(image) { result in\r\n```"},"comment":{"url":"https://api.github.com/repos/pinterest/PINCache/issues/comments/234319093","html_url":"https://github.com/pinterest/PINCache/issues/77#issuecomment-234319093","issue_url":"https://api.github.com/repos/pinterest/PINCache/issues/77","id":234319093,"user":{"login":"garrettmoon","id":90045,"avatar_url":"https://avatars.githubusercontent.com/u/90045?v=3","gravatar_id":"","url":"https://api.github.com/users/garrettmoon","html_url":"https://github.com/garrettmoon","followers_url":"https://api.github.com/users/garrettmoon/followers","following_url":"https://api.github.com/users/garrettmoon/following{/other_user}","gists_url":"https://api.github.com/users/garrettmoon/gists{/gist_id}","starred_url":"https://api.github.com/users/garrettmoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garrettmoon/subscriptions","organizations_url":"https://api.github.com/users/garrettmoon/orgs","repos_url":"https://api.github.com/users/garrettmoon/repos","events_url":"https://api.github.com/users/garrettmoon/events{/privacy}","received_events_url":"https://api.github.com/users/garrettmoon/received_events","type":"User","site_admin":false},"created_at":"2016-07-21T17:08:07Z","updated_at":"2016-07-21T17:08:07Z","body":"This should be fixed in the PINRemoteImage beta!"}}
{"actor":{"display_login":"garrettmoon"}}