I tried to catch the decoding of the image file, but it could not catch an exception from memory, and the application would work.
I know some tricks in decoding an image file, for example, subsamples. But I need to enlarge the image to see the details, so I canโt calculate it too much. For some newer devices, it will manage to allocate more memory to avoid being deleted from memory.
For some older devices, it cannot.
If I can configure the application for different devices, this will be welcome.
So I want: (1) I hope I can throw an exception out of memory, so if I catch it, I can reduce the image size. (2) Or, I hope I can get the size of the available memory to accommodate.
I search the Internet, I canโt find the answers.
source share