danylovolokh / VideoPlayerManager

This is a project designed to help controlling Android MediaPlayer class. It makes it easier to use MediaPlayer ListView and RecyclerView. Also it tracks the most visible item in scrolling list. When new item in the list become the most visible, this library gives an API to track it.
3.15k stars 747 forks source link

OutOfMemoryError #43

Open Aspsine opened 8 years ago

Aspsine commented 8 years ago

Thanks for sharing the excellent lib. Your code is very beautiful. I am very enjoy reading the source code.

I scrolled quickly and kept switch fragments(RecyclerView & ListView). At the same time I noticed that the memories kept growing until OOM.

Error logs is below.

08-15 11:08:56.990 6263-6294/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 157.934ms for cause Alloc
08-15 11:08:57.028 6263-11472/com.volokh.danylo.videolist W/art: Suspending all threads took: 37.219ms
08-15 11:08:57.034 6263-6294/com.volokh.danylo.videolist I/art: Clamp target GC heap from 259MB to 256MB
08-15 11:08:57.035 6263-6294/com.volokh.danylo.videolist I/art: Alloc partial concurrent mark sweep GC freed 5(160B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 5.883ms total 44.531ms
08-15 11:08:57.035 6263-6297/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 223.501ms for cause Background
08-15 11:08:57.048 6263-6294/com.volokh.danylo.videolist W/art: Suspending all threads took: 12.628ms
08-15 11:08:57.057 6263-6297/com.volokh.danylo.videolist I/art: Background sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 8.131ms total 21.922ms
08-15 11:08:57.057 6263-12868/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 181.528ms for cause Alloc
08-15 11:08:57.096 6263-6297/com.volokh.danylo.videolist W/art: Suspending all threads took: 38.170ms
08-15 11:08:57.103 6263-12868/com.volokh.danylo.videolist I/art: Clamp target GC heap from 259MB to 256MB
08-15 11:08:57.103 6263-12868/com.volokh.danylo.videolist I/art: Alloc partial concurrent mark sweep GC freed 5(160B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 6.415ms total 46.148ms
08-15 11:08:57.103 6263-11936/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 135.573ms for cause Alloc
08-15 11:08:57.104 6263-12390/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 135.712ms for cause Alloc
08-15 11:08:57.172 6263-12868/com.volokh.danylo.videolist W/art: Suspending all threads took: 67.952ms
08-15 11:08:57.174 6263-12390/com.volokh.danylo.videolist I/art: Clamp target GC heap from 259MB to 256MB
08-15 11:08:57.175 6263-12390/com.volokh.danylo.videolist I/art: Alloc concurrent mark sweep GC freed 1(32B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 5.807ms total 70.670ms
08-15 11:08:57.175 6263-6292/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 206.684ms for cause Alloc
08-15 11:08:57.175 6263-6263/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 185.490ms for cause Alloc
08-15 11:08:57.241 6263-12390/com.volokh.danylo.videolist W/art: Suspending all threads took: 66.057ms
08-15 11:08:57.242 6263-6292/com.volokh.danylo.videolist W/art: Suspending all threads took: 66.288ms
08-15 11:08:57.249 6263-12390/com.volokh.danylo.videolist I/art: Forcing collection of SoftReferences for 28B allocation
08-15 11:08:57.251 6263-6263/com.volokh.danylo.videolist I/art: Clamp target GC heap from 260MB to 256MB
08-15 11:08:57.251 6263-6263/com.volokh.danylo.videolist I/art: Alloc concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 256MB/256MB, paused 7.401ms total 75.716ms
08-15 11:08:57.251 6263-11472/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 217.432ms for cause Alloc
08-15 11:08:57.291 6263-6263/com.volokh.danylo.videolist W/art: Suspending all threads took: 38.708ms
08-15 11:08:57.298 6263-6263/com.volokh.danylo.videolist E/art: Throwing OutOfMemoryError "Failed to allocate a 160 byte allocation with 0 free bytes and 0B until OOM" (recursive case)
08-15 11:08:57.299 6263-11472/com.volokh.danylo.videolist I/art: Clamp target GC heap from 259MB to 256MB
08-15 11:08:57.299 6263-11472/com.volokh.danylo.videolist I/art: Alloc partial concurrent mark sweep GC freed 6(192B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 7.629ms total 47.935ms
08-15 11:08:57.299 6263-12071/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 265.746ms for cause Alloc
08-15 11:08:57.299 6263-6294/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 240.246ms for cause Alloc
08-15 11:08:57.300 6263-11269/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 197.357ms for cause Alloc
08-15 11:08:57.300 6263-6297/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 126.784ms for cause Background
08-15 11:08:57.300 6263-7749/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 51.113ms for cause Alloc
08-15 11:08:57.300 6263-12390/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 51.188ms for cause Alloc
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art: "main" prio=5 tid=1 Runnable
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:   | group="main" sCount=1 dsCount=0 obj=0x75533fb0 self=0x7f7c09a000
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:   | sysTid=6263 nice=0 cgrp=default sched=0/0 handle=0x7f8012a0a8
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:   | state=R schedstat=( 53469643793 11767592009 71260 ) utm=4473 stm=873 core=0 HZ=100
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:   | stack=0x7ffa23b000-0x7ffa23d000 stackSize=8MB
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:   | held mutexes= "mutator lock"(shared held)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.BitmapDrawable$BitmapState.<init>(BitmapDrawable.java:906)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.BitmapDrawable.mutate(BitmapDrawable.java:682)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.DrawableContainer$DrawableContainerState$ConstantStateFuture.get(DrawableContainer.java:1130)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.DrawableContainer$DrawableContainerState.createAllFutures(DrawableContainer.java:786)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.DrawableContainer$DrawableContainerState.applyTheme(DrawableContainer.java:843)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.DrawableContainer.applyTheme(DrawableContainer.java:571)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.DrawableContainer$DrawableContainerState.applyTheme(DrawableContainer.java:849)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.DrawableContainer.applyTheme(DrawableContainer.java:571)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.StateListDrawable.applyTheme(StateListDrawable.java:391)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.graphics.drawable.AnimatedStateListDrawable.applyTheme(AnimatedStateListDrawable.java:391)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.content.res.Resources.loadDrawable(Resources.java:2700)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.CompoundButton.<init>(CompoundButton.java:87)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.RadioButton.<init>(RadioButton.java:65)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.RadioButton.<init>(RadioButton.java:61)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.widget.AppCompatRadioButton.<init>(AppCompatRadioButton.java:58)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.widget.AppCompatRadioButton.<init>(AppCompatRadioButton.java:54)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:124)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:1008)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1067)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:731)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.LayoutInflater.inflate(LayoutInflater.java:488)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.LayoutInflater.inflate(LayoutInflater.java:420)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.view.menu.ListMenuItemView.insertRadioButton(ListMenuItemView.java:265)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.view.menu.ListMenuItemView.setCheckable(ListMenuItemView.java:146)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.view.menu.ListMenuItemView.initialize(ListMenuItemView.java:109)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.support.v7.view.menu.MenuAdapter.getView(MenuAdapter.java:92)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.AbsListView.obtainView(AbsListView.java:2572)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.ListView.makeAndAddView(ListView.java:1953)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.ListView.fillDown(ListView.java:754)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.ListView.fillFromTop(ListView.java:819)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.ListView.layoutChildren(ListView.java:1748)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.AbsListView.onLayout(AbsListView.java:2332)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.View.layout(View.java:16112)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.ViewGroup.layout(ViewGroup.java:5185)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.View.layout(View.java:16112)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.ViewGroup.layout(ViewGroup.java:5185)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2523)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2215)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1312)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6671)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.Choreographer.doCallbacks(Choreographer.java:603)
08-15 11:08:57.349 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.Choreographer.doFrame(Choreographer.java:572)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at android.os.Handler.handleCallback(Handler.java:815)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at android.os.Handler.dispatchMessage(Handler.java:104)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at android.os.Looper.loop(Looper.java:194)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at android.app.ActivityThread.main(ActivityThread.java:5803)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at java.lang.reflect.Method.invoke!(Native method)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at java.lang.reflect.Method.invoke(Method.java:372)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1009)
08-15 11:08:57.350 6263-6263/com.volokh.danylo.videolist E/art:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:804)
08-15 11:08:57.353 6263-11472/com.volokh.danylo.videolist W/art: Suspending all threads took: 53.183ms
08-15 11:08:57.419 6263-12390/com.volokh.danylo.videolist I/art: Clamp target GC heap from 259MB to 256MB
08-15 11:08:57.419 6263-12390/com.volokh.danylo.videolist I/art: Alloc concurrent mark sweep GC freed 203(14KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 5.422ms total 118.431ms
08-15 11:08:57.432 6263-12390/com.volokh.danylo.videolist W/art: Suspending all threads took: 12.753ms
08-15 11:08:57.440 6263-6297/com.volokh.danylo.videolist I/art: Background sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 6.738ms total 20.426ms
08-15 11:08:57.440 6263-6292/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 190.807ms for cause Alloc
08-15 11:08:57.440 6263-7148/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 190.944ms for cause Alloc
08-15 11:08:57.440 6263-6263/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 85.256ms for cause Alloc
08-15 11:08:57.440 6263-6354/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 142.096ms for cause Alloc
08-15 11:08:57.441 6263-11999/com.volokh.danylo.videolist I/art: WaitForGcToComplete blocked for 85.926ms for cause Alloc
08-15 11:08:57.478 6263-6263/com.volokh.danylo.videolist E/AndroidRuntime: FATAL EXCEPTION: main
08-15 11:08:57.487 6263-6297/com.volokh.danylo.videolist I/art: Clamp target GC heap from 259MB to 256MB
08-15 11:08:57.487 6263-6297/com.volokh.danylo.videolist I/art: Background partial concurrent mark sweep GC freed 158(10KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 6.652ms total 43.795ms
08-15 11:08:57.605 6263-6263/com.volokh.danylo.videolist I/Process: Sending signal. PID: 6263 SIG: 9
denizkatipoglu commented 6 years ago

you should put pagination in the scrool page it may fix your problem