I have a callback for getting an image from a 3rd ...
# random
c
I have a callback for getting an image from a 3rd party library. I can get it back in either a byte[] or a bitmap. Should I favor one or the other for memory purposes or something?
p
I don't have a qualified answer but there were some topics regarding native memory not counting towards the jvm memory pool
c
Are either of those allocated in the native heap space?
r
Well assuming the byte[] is JPG, PNG etc it'll be a lot smaller than an ARGB 888 Bitmap
But this doesn't matter if you just want to render it and you're going to turn it straight into a Bitmap anyway (assuming you don't have any extra information or requirements that the library doesn't have)
So I'd say only use byte[] if you don't actually want a Bitmap (obviously) or if you think you can do the Bitmap conversion better than the library (unlikely but depends on your use case and how customisable the library output is)
c
Interesting. That's super helpful. Thanks robert! In my case... I was basically just going to render it anyway. and so. i guess grabbing a byte[] and converting to a bitmap doesn't make sense if the 3rd party can give me a bitmap instead. cheers
👍 1