Hi Erel,
In fact, I am not sure about anything...everything is very strange
I modified the cameraEx example, just adding some memory tracking. Each time I rotate the device, the memory is less, but only very slightly. There can be small memory releases from time to time (i.e., not always decreases), but what it is sure is that after 20 changes of orientation (for instance), the memory is less. This happens in a Android 2.3 device, not in a 4.x
If this was the only thing, would not be a real problem for me, since the probability that there are so many changes of orientation is very small.
But, going back to the app I am developing, which uses the camEx library, my memory "went away" very quickly. So I started to remove things to isolate the problem , and what I got is very strange.
After removing most of the code, at the end I could reproduce the "bad" behaviour in a small code , with two non-overlapping panels: The first is used for the camera and the second for a canvas in which (in this example) i draw a circle. I attach the code
There are two global boolean variables which are only assigned when FirstTime=True, in this code I use them as some sort of compilation directives
USE_CAM (if True, we will init the cam and show the preview in Panel1)
USE_CANVAS (if true, we will draw a canvas on Panel2)
When USE_CANVAS=True and USE_CAM=False, -----> everything is ok, no memory is lost
When USE_CANVAS=False and USE_CAM=True, -----> only a bit of memory less each time, but I don't mind since it is very small, and I am not sure that perhaps it will recover later
But...
When USE_CANVAS=True and USE_CAM=True, memory gets lost more quickly after each rotation. If I keep on rotating, OOM appears
I have observed that the outofmemory errors come when the remaining memory is about to zero, not always at the same moment, but more or less.
(1)MaxMem: 6.7108864E7
(2)HeapSize:8331232 (Free: 3474576)
(4)NativeUsage: 9404080
FreeTotal (1)-(4) : 57704784
FreefromHeap (1)-(2-3)-(4): 51608.34375 (this is the number I monitor since when it decreases a lot is when OOM errors appear)
So, I am totally confused, since those things didn't happen on the other device I was developing. And both panels are totally independent.
I am about to release my app, and I had not paid attention to it at the beginning, and now I don't know what to do to solve it.
Please help. No ideas left