MobileRTCShareView bitmap sharing Ram usage keeps increasing I think memory leak

I use share MobileRTCShareView to share a bitmap to zoom meetings( the MobileRTCShareView is updated multiple times a second using :

mShareView.setVisibility(View.VISIBLE)
      mShareView.setImageBitmap(bitmap)  
      if ( !mInMeetingShareController.isSharingOut()) {
            mInMeetingShareController.addListener(zoomShareListener)
            mInMeetingShareController.startShareViewSession();
        }else {

        mInMeetingShareController.startShareViewContent(mShareView)}

I replaced MobileRTCShareView with an ImageView and joined a meeting (without sharing of course) and it works fine.

after I start sharing the ram usage increase until crashes. if I stopped sharing the ram usage drops to normal (from 2GB to 300MB) until I start sharing again then it starts increasing again.

there are multiple memory leaks that refernce zoom SDK but I believe MobileRTCShareView is what causing my issue:

canary leak output:
1:

┬───
│ GC Root: Global variable in native code

├─ com.zipow.videobox.sdk.SDKAnnotationMgr class
│ Leaking: NO (a class is never leaking)
│ ↓ static SDKAnnotationMgr.instance
│ ~~~~~~~~
├─ com.zipow.videobox.sdk.SDKAnnotationMgr instance
│ Leaking: UNKNOWN
│ ↓ SDKAnnotationMgr.annotateToolDelegate
│ ~~~~~~~~~~~~~~~~~~~~
├─ us.zoom.sdk.MobileRTCShareView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ mContext instance of com.jibb.jibb.WhiteboardSession with mDestroyed = true
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.sharingView
│ View.mWindowAttachCount = 1
│ ↓ MobileRTCShareView.mParent
╰→ android.widget.FrameLayout instance
​ Leaking: YES (ObjectWatcher was watching this because com.jibb.jibb.IpsaRenderedImageView received Fragment#onDestroyView() callback (references to its views should be cleared to prevent leaks) and View.mContext references a destroyed activity)
​ key = 553ece21-f950-48fd-9c92-acb0ad4e79d6
​ watchDurationMillis = 5579
​ retainedDurationMillis = 578
​ key = 3fcef0ed-61c4-4aea-88f6-9f02cad2f6d8
​ watchDurationMillis = 5578
​ retainedDurationMillis = 577
​ mContext instance of com.jibb.jibb.WhiteboardSession with mDestroyed = true
​ View#mParent is null
​ View#mAttachInfo is null (view detached)
​ View.mWindowAttachCount = 1
METADATA
Build.VERSION.SDK_INT: 28
Build.MANUFACTURER: samsung
LeakCanary version: 2.2
App process name: com.jibb.jibb
Analysis duration: 139661 ms

2:

┬───
│ GC Root: Global variable in native code

├─ com.zipow.videobox.confapp.ConfUI class
│ Leaking: NO (a class is never leaking)
│ ↓ static ConfUI.instance
│ ~~~~~~~~
├─ com.zipow.videobox.confapp.ConfUI instance
│ Leaking: UNKNOWN
│ ↓ ConfUI.mListenerList
│ ~~~~~~~~~~~~~
├─ us.zoom.androidlib.util.ListenerList instance
│ Leaking: UNKNOWN
│ ↓ ListenerList.mList
│ ~~~~~
├─ java.util.Vector instance
│ Leaking: UNKNOWN
│ ↓ Vector.elementData
│ ~~~~~~~~~~~
├─ java.lang.Object array
│ Leaking: UNKNOWN
│ ↓ Object.[0]
│ ~~~
├─ com.zipow.videobox.sdk.SDKShareView$2 instance
│ Leaking: UNKNOWN
│ Anonymous subclass of com.zipow.videobox.confapp.ConfUI$SimpleConfUIListener
│ ↓ SDKShareView$2.this$0
│ ~~~~~~
├─ us.zoom.sdk.MobileRTCShareView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ mContext instance of com.jibb.jibb.WhiteboardSession with mDestroyed = true
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.sharingView
│ View.mWindowAttachCount = 1
│ ↓ MobileRTCShareView.mContext
╰→ com.jibb.jibb.WhiteboardSession instance
​ Leaking: YES (ObjectWatcher was watching this because com.jibb.jibb.WhiteboardSession received Activity#onDestroy() callback and Activity#mDestroyed is true)
​ key = f0493245-d0de-4180-b656-ac05b291ca20
​ watchDurationMillis = 5628
​ retainedDurationMillis = 626
METADATA
Build.VERSION.SDK_INT: 28
Build.MANUFACTURER: samsung
LeakCanary version: 2.2
App process name: com.jibb.jibb
Analysis duration: 179658 ms

3:

┬───
│ GC Root: Global variable in native code

├─ com.jibb.jibb.Zoom.ZoomClass class
│ Leaking: NO (a class is never leaking)
│ ↓ static ZoomClass.contextBig
│ ~~~~~~~~~~
╰→ com.jibb.jibb.WhiteboardSession instance
​ Leaking: YES (ObjectWatcher was watching this because com.jibb.jibb.WhiteboardSession received Activity#onDestroy() callback and Activity#mDestroyed is true)
​ key = d45f6522-379e-484c-b553-e8b9a209b61c
​ watchDurationMillis = 5591
​ retainedDurationMillis = 589
METADATA
Build.VERSION.SDK_INT: 28
Build.MANUFACTURER: samsung
LeakCanary version: 2.2
App process name: com.jibb.jibb
Analysis duration: 139661 ms

I tried the Zoom sample app it also has memory leaks but less and not as frequent. not the same ones

example :

┬───
│ GC Root: System class

├─ android.app.SemAppIconSolution class
│ Leaking: NO (a class is never leaking)
│ ↓ static SemAppIconSolution.uniqueInstance
│ ~~~~~~~~~~~~~~
├─ android.app.SemAppIconSolution instance
│ Leaking: UNKNOWN
│ ↓ SemAppIconSolution.mContext
│ ~~~~~~~~
├─ android.app.ContextImpl instance
│ Leaking: UNKNOWN
│ ↓ ContextImpl.mAutofillClient
│ ~~~~~~~~~~~~~~~
╰→ us.zoom.sdksample.inmeetingfunction.zoommeetingui.CustomZoomUIActivity instance
​ Leaking: YES (ObjectWatcher was watching this because us.zoom.sdksample.inmeetingfunction.zoommeetingui.CustomZoomUIActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
​ key = 2c1fdfc3-b827-4695-9e17-9d5b22ddff4a
​ watchDurationMillis = 36994
​ retainedDurationMillis = 31993
METADATA
Build.VERSION.SDK_INT: 28
Build.MANUFACTURER: samsung
LeakCanary version: 2.2
App process name: us.zoom.sdkexample
Analysis duration: 13288 ms

so how can I share frequents bitmaps without RAM usage increasing until a crash?

Hi mohammed.aljammali,

Thanks for the post. What is the SDK version you are using that has this issue? Could you have a try with the latest version of SDK?

Thanks!