public void onServiceConnected(ComponentName name, IBinder service) { // Get Connected the the IDL mRemoteInterface = IRemoteService.Stub.asInterface(service); if (null != mRemoteInterface) { // Register Callbacks try { mRemoteInterface.registerCallback(mServiceCallback); } catch (RemoteException e1) { e1.printStackTrace(); } } }
// Disconnecting from the service if (null != mMediaRemoteInterface) { // unregister callbacks try { mMediaRemoteInterface.unregisterCallback(mMediaServiceCallback); } catch (RemoteException e) { e.printStackTrace(); } mMediaRemoteInterface = null; } // unbind the service! try { this.unbindService(this); } catch( IllegalArgumentException e ){ e.printStackTrace(); } On Mar 7, 8:51 pm, Moto <medicalsou...@gmail.com> wrote: > Hi Mark, > Thanks for the reply... Ok, I'm calming down... :P > > I was able to determine via DDMS that after a few screen rotations the > allocated size would increase until my application would crash with an > out of memory exception. Also the number of Objects are increasing > after every screen rotation. > > My activity connects to a Service, and after I get connected I > register my callback function IRemoteServiceCallback. If I exclude > this call from my application I resolve the memory leak. Note that I > do unregister the service callback funtion. > > Thanks! > > On Mar 7, 7:37 pm, Mark Murphy <mmur...@commonsware.com> wrote: > > > Moto wrote: > > > I'm trying to figure out in every possible way how to target this leak > > > that specifically happens when I registerCallback to my service aidl > > > callback class. > > > I even tried commenting out the callback register on the callback and > > > I still get the leak! > > > /** > > > * The IRemoteInterface is defined through IDL > > > */ > > > private final IRemoteService.Stub mBinder = new > > > IRemoteService.Stub() { > > > public void registerCallback(IRemoteServiceCallback cb) { > > > if (cb != null) mCallbacks.register(cb); > > > } > > > public void unregisterCallback(IRemoteServiceCallback cb) { > > > if (cb != null) mCallbacks.unregister(cb); > > > } > > > }; > > > > MY HEAD IS ABOUT TO EXPLODE! I been trying so many things it's just > > > not working... Could it be an actual bug in Android? > > > > Any help is apreciated! > > > First, calm down. > > > Second, you think you are leaking...what? Activities? Services? Views? > > Bitmaps? Strings? Byte arrays? Something else? I can see that you are > > very concerned about these leaks, but until you tell us what it is that > > you think is leaking (beyond "memory"), we can't help you much. > > > Third, it would help if you could indicate how you are determining that > > you are leaking memory. For example, are you using DDMS's allocation > > tracker for this? Debug.dumpHprofData() and Eclipse's MAT? Something else? > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Android Training in US: 14-18 June 2010:http://bignerdranch.com > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en