Closed ghost closed 7 years ago
Hi,
I am using Rx java to get List from datastore and pass it to ViewState. When I repeat this action old List keeps alive in a memory (I suppose in ViewState was created strong reference). Is it normal behavior for Moxy?
getFeedItemsUseCase.perform(feedId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(feedItems -> { getViewState().setupFeedsItems(feedItems, 0); });
Activity has empty realization of the interface.
@StateStrategyType(AddToEndSingleStrategy.class) void setupFeedsItems(List<? extends FeedItem> feedItems, int position);
If wrap a List with WeakReference it will be removed from memory.
@StateStrategyType(AddToEndSingleStrategy.class) void setupFeedsItems(WeakReference<List<? extends FeedItem>> feedItems, int position);
I am using:
compile 'io.reactivex.rxjava2:rxandroid:2.0.0' compile 'io.reactivex.rxjava2:rxjava:2.0.0' compile 'com.arello-mobile:moxy-app-compat:1.4.5' annotationProcessor 'com.arello-mobile:moxy-compiler:1.4.5'
Well, feedItems will be kept while setupFeedsItems command contains in ViewState
Hi,
I am using Rx java to get List from datastore and pass it to ViewState. When I repeat this action old List keeps alive in a memory (I suppose in ViewState was created strong reference). Is it normal behavior for Moxy?
Activity has empty realization of the interface.
If wrap a List with WeakReference it will be removed from memory.
I am using: