{"action":"closed","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/960","repository_url":"https://api.github.com/repos/bumptech/glide","labels_url":"https://api.github.com/repos/bumptech/glide/issues/960/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/960/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/960/events","html_url":"https://github.com/bumptech/glide/issues/960","id":131278763,"number":960,"title":"byte[] buffer memory allocations keeps growing?","user":{"login":"rrahul","id":1327172,"avatar_url":"https://avatars3.githubusercontent.com/u/1327172?v=4","gravatar_id":"","url":"https://api.github.com/users/rrahul","html_url":"https://github.com/rrahul","followers_url":"https://api.github.com/users/rrahul/followers","following_url":"https://api.github.com/users/rrahul/following{/other_user}","gists_url":"https://api.github.com/users/rrahul/gists{/gist_id}","starred_url":"https://api.github.com/users/rrahul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrahul/subscriptions","organizations_url":"https://api.github.com/users/rrahul/orgs","repos_url":"https://api.github.com/users/rrahul/repos","events_url":"https://api.github.com/users/rrahul/events{/privacy}","received_events_url":"https://api.github.com/users/rrahul/received_events","type":"User","site_admin":false},"labels":[{"id":739139624,"url":"https://api.github.com/repos/bumptech/glide/labels/stale","name":"stale","color":"e28966","default":false}],"state":"closed","locked":false,"assignee":{"login":"TWiStErRob","id":2906988,"avatar_url":"https://avatars0.githubusercontent.com/u/2906988?v=4","gravatar_id":"","url":"https://api.github.com/users/TWiStErRob","html_url":"https://github.com/TWiStErRob","followers_url":"https://api.github.com/users/TWiStErRob/followers","following_url":"https://api.github.com/users/TWiStErRob/following{/other_user}","gists_url":"https://api.github.com/users/TWiStErRob/gists{/gist_id}","starred_url":"https://api.github.com/users/TWiStErRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWiStErRob/subscriptions","organizations_url":"https://api.github.com/users/TWiStErRob/orgs","repos_url":"https://api.github.com/users/TWiStErRob/repos","events_url":"https://api.github.com/users/TWiStErRob/events{/privacy}","received_events_url":"https://api.github.com/users/TWiStErRob/received_events","type":"User","site_admin":false},"assignees":[{"login":"TWiStErRob","id":2906988,"avatar_url":"https://avatars0.githubusercontent.com/u/2906988?v=4","gravatar_id":"","url":"https://api.github.com/users/TWiStErRob","html_url":"https://github.com/TWiStErRob","followers_url":"https://api.github.com/users/TWiStErRob/followers","following_url":"https://api.github.com/users/TWiStErRob/following{/other_user}","gists_url":"https://api.github.com/users/TWiStErRob/gists{/gist_id}","starred_url":"https://api.github.com/users/TWiStErRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWiStErRob/subscriptions","organizations_url":"https://api.github.com/users/TWiStErRob/orgs","repos_url":"https://api.github.com/users/TWiStErRob/repos","events_url":"https://api.github.com/users/TWiStErRob/events{/privacy}","received_events_url":"https://api.github.com/users/TWiStErRob/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2016-02-04T08:39:13Z","updated_at":"2017-11-19T07:08:32Z","closed_at":"2017-11-19T07:08:32Z","author_association":"NONE","body":"This is similar to https://github.com/bumptech/glide/issues/785 , in which GifDecode byte[] buffer memory allocations keeps growing, but not sure, if I have to add it as comment in the same issue, since it is in author-review-pending state. Hence raising as a new issue.\n\nI'm using glide 3.7.0, while scrolling in a list of 30-40 gif images ( I can see lot of byte arrays as mentioned in https://github.com/bumptech/glide/issues/785, accumulated over time)\nI am using glide like\n\n```\n        Glide.with(myapplicationcontext)\n                .load(uri)\n                .diskCacheStrategy(DiskCacheStrategy.NONE)\n                .crossFade()\n                .fitCenter()\n                .placeholder(R.drawable.placeholder)\n                .into(imageView);\n```\n\nfrom my CursorAdapter's `bindView()`.\n\nAnd my ImageView looks like\n\n```\n <ImageView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_gravity=\"center\"\n            android:adjustViewBounds=\"true\"\n            android:maxHeight=\"@dimen/max_width\"\n            android:maxWidth=\"@dimen/max_width\"/>\n```\n\nThe scrolling is laggy and out of memory error is thrown, after sometime.\n\n![1](https://cloud.githubusercontent.com/assets/1327172/12790131/24ada698-caa1-11e5-898e-679ab331665d.png)\n![2](https://cloud.githubusercontent.com/assets/1327172/12790130/24ac8376-caa1-11e5-8e97-36f13c7f6fac.png)\n![3](https://cloud.githubusercontent.com/assets/1327172/12790129/24ac3574-caa1-11e5-99f8-fc4f2d5a9a2c.png)\n\nI can see \n\n```\n  java.lang.OutOfMemoryError: Failed to allocate a 863052 byte allocation with 244432 free bytes and 238KB until OOM\n            at com.bumptech.glide.gifdecoder.GifDecoder.setData(GifDecoder.java:380)\n            at com.bumptech.glide.load.resource.gif.GifDrawable.<init>(GifDrawable.java:92)\n            at com.bumptech.glide.load.resource.gif.GifDrawable$GifState.newDrawable(GifDrawable.java:368)\n            at com.bumptech.glide.load.resource.drawable.DrawableResource.get(DrawableResource.java:32)\n            at com.bumptech.glide.load.resource.drawable.DrawableResource.get(DrawableResource.java:16)\n            at com.bumptech.glide.load.engine.EngineResource.get(EngineResource.java:44)\n            at com.bumptech.glide.request.GenericRequest.onResourceReady(GenericRequest.java:487)\n            at com.bumptech.glide.load.engine.EngineJob.handleResultOnMainThread(EngineJob.java:158)\n            at com.bumptech.glide.load.engine.EngineJob.access$100(EngineJob.java:22)\n            at com.bumptech.glide.load.engine.EngineJob$MainThreadCallback.handleMessage(EngineJob.java:202)\n            at android.os.Handler.dispatchMessage(Handler.java:98)\n            at android.os.Looper.loop(Looper.java:228)\n            at android.app.ActivityThread.main(ActivityThread.java:5514)\n            at java.lang.reflect.Method.invoke(Native Method)\n            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\n            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\n\n    java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Failed to allocate a 2067852 byte allocation with 443680 free bytes and 433KB until OOM\n            at java.util.concurrent.FutureTask.report(FutureTask.java:94)\n            at java.util.concurrent.FutureTask.get(FutureTask.java:164)\n            at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor.afterExecute(FifoPriorityThreadPoolExecutor.java:96)\n            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)\n            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)\n            at java.lang.Thread.run(Thread.java:818)\n            at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)\n     Caused by: java.lang.OutOfMemoryError: Failed to allocate a 2067852 byte allocation with 443680 free bytes and 433KB until OOM\n            at dalvik.system.VMRuntime.newNonMovableArray(Native Method)\n            at android.graphics.Bitmap.nativeCreate(Native Method)\n            at android.graphics.Bitmap.createBitmap(Bitmap.java:831)\n            at android.graphics.Bitmap.createBitmap(Bitmap.java:808)\n            at android.graphics.Bitmap.createBitmap(Bitmap.java:775)\n            at com.bumptech.glide.load.resource.bitmap.TransformationUtils.fitCenter(TransformationUtils.java:112)\n            at com.bumptech.glide.load.resource.bitmap.FitCenter.transform(FitCenter.java:24)\n            at com.bumptech.glide.load.resource.bitmap.BitmapTransformation.transform(BitmapTransformation.java:54)\n            at com.bumptech.glide.load.engine.DecodeJob.transform(DecodeJob.java:236)\n            at com.bumptech.glide.load.engine.DecodeJob.transformEncodeAndTranscode(DecodeJob.java:139)\n            at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:129)\n            at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)\n            at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)\n            at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)\n            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)\n            at java.util.concurrent.FutureTask.run(FutureTask.java:237)\n            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)\n            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)\n            at java.lang.Thread.run(Thread.java:818)\n            at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)\n```\n\n getting printed a lot of times, when I run into OOM\n\nI tried clearing memory cache and disk cache on onTrimMemory() manually (although I found it mentioned  in some other issues  it may not be needed). Also I tried  \n\n```\n   case SCROLL_STATE_IDLE:\n                    Glide.with(view.getContext()).resumeRequests();\n                    break;\n                case SCROLL_STATE_TOUCH_SCROLL:\n                case SCROLL_STATE_FLING:\n                    Glide.with(view.getContext()).pauseRequests();\n                    break;\n\n```\n\non scroll state changed. But still its running to OOM\n"}}
{"actor":{"display_login":"stale"}}