farhan678 / adwhirl

Automatically exported from code.google.com/p/adwhirl
0 stars 0 forks source link

AdWhirl Layout leaks threads #195

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In a shell on the device, run 'top -d 1 | grep adwhirl' to get continuously 
updating count of threads.
2. Run the Invoker app from the SDK
3. Change orientation

What is the expected output? What do you see instead?
Threads should remain constant. Instead, threads increase by 1 for each AdWhirl 
Layout present each time the screen is rotated and the activity is restarted.

What version of the product are you using? On what operating system?
Tested with latest mercurial repository checkout, and with 2.6.3.

If you disable both Adwhirl layouts, changing orientation does not lead to an 
increase in threads.

Original issue reported on code.google.com by ob.l...@gmail.com on 24 Mar 2011 at 1:10

GoogleCodeExporter commented 9 years ago
This is a pretty big problem. An extra thread is generated that never goes away 
with every AdWhirlLayout created. 

Orientation changes create one extra; the sleep cycle can cause two (or zero) 
depending on the screen orientation. The only way the threads will terminate is 
by manually shutting down the process with a task manager of some sort. Sooner 
or later the system starts running out of resources and bad things start to 
happen (*much* sooner if one happens to be debugging how an app handles 
orientation changes!).

I posted two screen shots. One is of the stock 3.0 SDK from the download site 
after 18 orientation/sleep events. It shows a new thread pool having been 
created for every change, each with a new pid. The other is of our build after 
30 such events showing a single process. The fix as described on the user forum 
seems to do the trick (see my followup there - 
http://groups.google.com/group/adwhirl-users/browse_thread/thread/ec7c58531b24a2
d2#).

Where are you guys at with this? Do you need/want to seem my code on that?

Original comment by goo...@yourarcade.com on 19 Apr 2011 at 3:09

Attachments: