FrankLove/android-screenshot-library

Performance Implications

Opened this issue · 2 comments

What steps will reproduce the problem?
1. Start the native service
2. Deploy and start the demo app
3. Taking quite a few screenshots
4. Returning to the home screen

What is the expected output? What do you see instead?
The phone becomes quite unresponsive back on the homescreen (i.e. it completely 
refreshes all the icons and widgets; it doesn't start the launcher or does that 
very slowly).
I also see a few "low memory" warnings from the ActivitiyManager in the logcat.

What are the performance implications of (a) running the asl-native service in 
the background? And (b) taking screenshots?

What version of the product are you using? On what operating system?
asl-1.2 demo
Android 2.2.1 on Google Nexus One

Please provide any additional information below.

Thanks

Original issue reported on code.google.com by scop...@gmx.net on 5 Jan 2011 at 2:32

I experience exactly the same problem. For some reason the native service tends 
to use an increasing amount of memory (you can see through "ps"), therefore the 
consequences related to slow responsiveness and home screen stuff. Can you 
please fix this memory leak or at least provide the source code of the service 
itself?

Original comment by luboga...@gmail.com on 9 May 2012 at 2:17

Hi everybody! I've managed to fix the problem with increasingly consumed 
memory. Sorry for my last dumb post. I just could not find the source at first.

Issue 13 explains a pretty important memory leak that has to be fixed as well, 
so fix it first.
In addition, the native library does not free the pict after it sends it to the 
client. To eliminate this problem you just have to change the code in main.c at 
line 220 to include the free of pict.buffer:

if (Send(cfd, pict.buffer, pict.xres * pict.yres * pict.bps / 8, 0) < 0) {
 free(pict.buffer);
 return -1;
}
free(pict.buffer);
Log ("- Screenshot sent");




Original comment by luboga...@gmail.com on 11 May 2012 at 12:00