简体   繁体   中英

RoboGuice resulting in a lot of GC_FOR_MALLOC

I have started using roboguice for one of the application. For the comparison I started with a splash screen with RoboActivity and three RoboAsyncTasks. When I had developed it with normal Activity and normal threads with context and handler passed to it, during entire splash activity execution not even once GC is getting called. But with a RoboActivity and @Context , 3 dependency injections of POJO and three RoboAsync task, GC_FOR_MALLOC is getting called 5 times.

Roboguice code

@ContentView(R.layout.activity_splash)
public final class Splash extends RoboActivity {

/**
 * Constant TAG used in debugging
 */
public static final String TAG = "###Splash###";

/**
 * To initialize singleton instance
 */
@Inject
private PreferenceManager mPreferenceManager;

@Inject
private DeviceInfo mDeviceInfo;

@Inject
private Handler mHandler;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
...

And below this i have simple web api calls in RoboAsyncTask.

Am I doing something wrong...or does use of RoboGuice results into unnecessary object creations.

A bit of research showed me that annotations are not very good to use. And I personally felt that roboguice was adding a lot of backend code which we can manually do at a little expense. So removed roboguice from my build and the behavior is much more better than earlier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM