-1

I've wrote a simple HTTP request, that handles my HTTP requests so i don't want to use a library

everything works with the requests but there are a few memory leaks, I have found a memory leak but i don't know how to solve it

This is my file class

https://gist.github.com/BioGram/6e7a6ae927e76046ee1aa5d5e7b3ff57#file-requesthandler-java-L173

line 173 that BitmapView will leaks

Would be appreciated, if you provide a solution

A Dev
  • 82
  • 1
  • 10

2 Answers2

1

The memory leak problem occurs when you are trying to process a big file like a big bitmap. To prevent this issue, you have two ways. First is to reduce the size of the image before processing it. Second is to add this line given below in your Android manifest "Application" tag.

android:largeHeap="true"
Zohaib Hassan
  • 984
  • 2
  • 7
  • 11
  • your solution is about **OutOfMemory** not memory leak they are different – A Dev May 09 '17 at 22:33
  • Sorry I mixed these two scenarios. Please check this link given below, hope this will help. http://blog.nimbledroid.com/2016/09/06/stop-memory-leaks.html – Zohaib Hassan May 09 '17 at 22:45
0

I've found a better solution, Instead of using a direct reference using a bitmap callback so problem solve

Updated Version: https://github.com/BioGram/Android/commit/e981bd225e1960aec2ddee58461dde1e64db2c61

A Dev
  • 82
  • 1
  • 10