{"action":"opened","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/833","labels_url":"https://api.github.com/repos/bumptech/glide/issues/833/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/833/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/833/events","html_url":"https://github.com/bumptech/glide/issues/833","id":123313967,"number":833,"title":"Out of Memory in BitMapFactory","user":{"login":"monkichi99","id":16387716,"avatar_url":"https://avatars.githubusercontent.com/u/16387716?v=3","gravatar_id":"","url":"https://api.github.com/users/monkichi99","html_url":"https://github.com/monkichi99","followers_url":"https://api.github.com/users/monkichi99/followers","following_url":"https://api.github.com/users/monkichi99/following{/other_user}","gists_url":"https://api.github.com/users/monkichi99/gists{/gist_id}","starred_url":"https://api.github.com/users/monkichi99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkichi99/subscriptions","organizations_url":"https://api.github.com/users/monkichi99/orgs","repos_url":"https://api.github.com/users/monkichi99/repos","events_url":"https://api.github.com/users/monkichi99/events{/privacy}","received_events_url":"https://api.github.com/users/monkichi99/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-21T16:42:40Z","updated_at":"2015-12-21T16:42:40Z","closed_at":null,"body":"I don't understand the following error.\r\n\r\nThe original image is 5000 x 5000 decode in ARGB_8888 which equate to 12.5MB, but I have configured glide to use the screen size of 1920 x 1200 which should roughly equate to 1.2MB. But why is it trying to allocate BitMap of the original size and not the scaled down size?\r\n\r\nHere is my glide configuration\r\n\r\n        GlideLoadConfig config = new GlideLoadConfig.Builder()\r\n                .fitCenter()\r\n                .withDecodeFormat(DecodeFormat.PREFER_ARGB_8888)\r\n                .build();\r\n\r\n//Extended ImageLoader cdoe\r\n            @Override\r\n            public Target getLoadTarget(@NonNull ImageView imageView) {\r\n                return new TransitionImageViewTarget(imageView.getContext(), imageView);\r\n            }\r\n\r\n            @Override\r\n            protected void appendAdditionalParameters(int index, @NonNull Item item,\r\n                                                      @NonNull GenericRequestBuilder<Item, ?, ?, ?> builder) {\r\n                super.appendAdditionalParameters(index, item, builder);\r\n                //calculated screen size of 1920 x 1200\r\n                builder.override(size.getWidth(), size.getHeight());\r\n                builder.priority(Priority.HIGH);\r\n                builder.signature(new StringSignature(item.getObjectId().toString()));\r\n            }\r\n\r\npublic class TransitionImageViewTarget extends BitmapImageViewTarget {\r\n\r\n    private final Context context;\r\n\r\n    private ImageView view;\r\n\r\n    public TransitionImageViewTarget(Context context, ImageView view) {\r\n        super(view);\r\n        this.context = context;\r\n        this.view = view;\r\n    }\r\n\r\n    @Override\r\n    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {\r\n        Drawable current = view.getDrawable();\r\n        if (current != null) {\r\n            GlideTransitionDrawable transitionDrawable = new GlideTransitionDrawable(context, resource, current);\r\n            view.setImageDrawable(transitionDrawable);\r\n        } else {\r\n            super.onResourceReady(resource, glideAnimation);\r\n        }\r\n    }\r\n}\r\n\r\n\r\n//loading the image into the imageView\r\n        BitmapRequestBuilder<T, Bitmap> builder = buildBaseRequest(item, getViewActivity(imageView));\r\n        builder.placeholder(placeholderDrawable);\r\n               builder.listener(new RequestListenerTuple<>(loadListener, requestListener));\r\n        appendGlideConfigParameters(builder, glideLoadConfig);\r\n        appendAdditionalParameters(index, item, builder);\r\n\r\n        if (requestListener != null) {\r\n            requestListener.onLoadStarted();\r\n        }\r\n\r\n        builder.into(getLoadTarget(imageView));\r\n\r\nD/dalvikvm(26154): GC_FOR_ALLOC freed 7935K, 31% free 36946K/53063K, paused 74ms\r\nI/dalvikvm-heap(26154): Forcing collection of SoftReferences for 25000016-byte allocation\r\nD/dalvikvm(26154): GC_BEFORE_OOM freed 12K, 31% free 36933K/53063K, paused 77ms\r\nE/dalvikvm-heap(26154): Out of memory on a 25000016-byte allocation.\r\nI/dalvikvm(26154): \"fifo-pool-thread-0\" prio=5 tid=71 RUNNABLE\r\nI/dalvikvm(26154):   | group=\"main\" sCount=0 dsCount=0 obj=0x41ee51e0 self=0x12b5838\r\nI/dalvikvm(26154):   | sysTid=26404 nice=10 sched=0/0 cgrp=bg_non_interactive handle=19541776\r\nI/dalvikvm(26154):   | schedstat=( 0 0 0 ) utm=1923 stm=377 core=0\r\nI/dalvikvm(26154):   at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)\r\nI/dalvikvm(26154):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeStream(Downsampler.java:329)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.Downsampler.downsampleWithSize(Downsampler.java:220)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:153)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:50)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:19)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:39)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:20)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.engine.DecodeJob.decodeFromSourceData(DecodeJob.java:190)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.engine.DecodeJob.decodeSource(DecodeJob.java:177)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:128)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)\r\nI/dalvikvm(26154):   at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)\r\nI/dalvikvm(26154):   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)\r\nI/dalvikvm(26154):   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)\r\nI/dalvikvm(26154):   at java.util.concurrent.FutureTask.run(FutureTask.java:137)\r\nI/dalvikvm(26154):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\r\nI/dalvikvm(26154):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\r\nI/dalvikvm(26154):   at java.lang.Thread.run(Thread.java:856)"}}