Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryError #35

Open
Maragues opened this issue Apr 14, 2017 · 2 comments
Open

OutOfMemoryError #35

Maragues opened this issue Apr 14, 2017 · 2 comments

Comments

@Maragues
Copy link

Maragues commented Apr 14, 2017

I'm seeing this OOM after ~6 hours of running an application

Clamp target GC heap from 96.827MB to 96.000MB
GC_BEFORE_OOM freed 73K, 8% free 90855K/98304K, paused 566ms, total 566ms
Out of memory on a 2097168-byte allocation.
"MyInteractorThread" prio=5 tid=17 RUNNABLE
  | group="main" sCount=0 dsCount=0 obj=0x42273ad8 self=0x556c8008
  | sysTid=12621 nice=0 sched=0/0 cgrp=apps/bg_non_interactive handle=1431377544
  | state=R schedstat=( 0 0 0 ) utm=113074 stm=11704 core=1
  at java.util.HashMap.makeTable(HashMap.java:~569)
  at java.util.HashMap.doubleCapacity(HashMap.java:589)
  at java.util.HashMap.put(HashMap.java:419)
  at com.frogermcs.androiddevmetrics.internal.metrics.InitManager.putInitMetric(InitManager.java:60)
  at com.frogermcs.androiddevmetrics.internal.metrics.InitManager.addInitMetric(InitManager.java:55)
  at com.frogermcs.androiddevmetrics.aspect.Dagger2GraphAnalyzer.logAndExecute(Dagger2GraphAnalyzer.java:71)
  at com.mycompany.dagger.PreferencesModule.provideMyPrefsProvider(PreferencesModule.java:29)
  at com.mycompany.dagger.PreferencesModule_ProvideMyPrefsProviderFactory.get(PreferencesModule_ProvideMyPrefsProviderFactory.java:24)
  at com.mycompany.dagger.PreferencesModule_ProvideMyPrefsProviderFactory.get(PreferencesModule_ProvideMyPrefsProviderFactory.java:8)
  at com.mycompany.dagger.DaggerAppComponent.myPrefsPreferences(DaggerAppComponent.java:370)
  at com.mycompany.bluetooth.response_processing.DataBlockMediator.processDataBlock(DataBlockMediator.java:93)
  at com.mycompany.bluetooth.response_processing.DataBlockMediator.onNewDataBlock(DataBlockMediator.java:53)
  at com.mycompany.bluetooth.ResponseMediator.onNewDataBlock(ResponseMediator.java:162)
  at com.mycompany.bluetooth.response_processing.processor.shared.SharedDataProcessor.propagateDataBlock(SharedDataProcessor.java:66)
  at com.mycompany.bluetooth.response_processing.processor.shared.SharedDataProcessor.process(SharedDataProcessor.java:57)
  at com.mycompany.bluetooth.ResponseMediator.onNewParsedMessage(ResponseMediator.java:98)
  at com.mycompany.bluetooth.ResponseMediator$$Lambda$1.accept((null):-1)
  at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onNext(FlowableDoOnEach.java:85)
  at io.reactivex.processors.UnicastProcessor.drainRegular(UnicastProcessor.java:213)
  at io.reactivex.processors.UnicastProcessor.drain(UnicastProcessor.java:289)
  at io.reactivex.processors.UnicastProcessor.onNext(UnicastProcessor.java:352)
  at com.mycompany.bluetooth.response_processing.parser.ResponseParser.onFinalState(ResponseParser.java:139)
  at com.mycompany.bluetooth.response_processing.parser.ResponseParser.parseByte(ResponseParser.java:127)
  at com.mycompany.bluetooth.response_processing.parser.ResponseParser$$Lambda$1.accept((null):-1)
  at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onNext(FlowableDoOnEach.java:85)
  at io.reactivex.processors.PublishProcessor$PublishSubscription.onNext(PublishProcessor.java:316)
  at io.reactivex.processors.PublishProcessor.onNext(PublishProcessor.java:198)
  at com.mycompany.bluetooth.response_processing.parser.ResponseParser.lambda$parse$0(ResponseParser.java:108)
  at com.mycompany.bluetooth.response_processing.parser.ResponseParser$$Lambda$2.accept((null):-1)
  at io.reactivex.internal.operators.observable.ObservableDoOnEach$DoOnEachObserver.onNext(ObservableDoOnEach.java:95)
  at io.reactivex.internal.operators.observable.ObservableRange$RangeDisposable.run(ObservableRange.java:64)
  at io.reactivex.internal.operators.observable.ObservableRange.subscribeActual(ObservableRange.java:35)
  at io.reactivex.Observable.subscribe(Observable.java:10841)
  at io.reactivex.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
  at io.reactivex.Observable.subscribe(Observable.java:10841)
  at io.reactivex.Observable.subscribe(Observable.java:10827)
  at io.reactivex.Observable.subscribe(Observable.java:10705)
  at com.mycompany.bluetooth.response_processing.parser.ResponseParser.parse(ResponseParser.java:109)
  at com.mycompany.bluetooth.ResponseMediator.processResponse(ResponseMediator.java:71)
  at com.mycompany.bluetooth.MyFacadeImpl$BTHandler.handleMessage(MyFacadeImpl.java:529)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:136)
  at android.os.HandlerThread.run(HandlerThread.java:61)

We provide preferences through Dagger2 and we were not using @singleton, so I'm guessing that androiddevmetrics annotated that initialization, and since we receive information every 250ms and update several preferences, it quickly exhausted the heap.

In any case, I'd say that shouldn't be happening. While for other apps it may not cause an OOM, it definitely is using memory.

@Maragues
Copy link
Author

After some more testing I'm still seeing the OOM, so it might not be related to this library

@Maragues
Copy link
Author

Maragues commented Apr 14, 2017

Analyzing the hprof after 3 hours, it does look like the library is the one exhausting the memory

image

image

image

@Maragues Maragues reopened this Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant