RxCoreLocation icon indicating copy to clipboard operation
RxCoreLocation copied to clipboard

Possible "memory effect" on .rx.location

Open Narayane opened this issue 4 years ago • 0 comments

Hi,

I am using several instances of CLLocationManager (configured slightly differently) potentially at the same time and scoped to dedicated Rx streams (for each, I initiate a new CLLocationManager() that I specifically configure, then I call startUpdatingLocation() at stream's subscription, and I call stopUpdatingLocation() at the disposal) returning what the RxCoreLocation extension .rx.location provides me in the meantime.

In this context, I have, among other things, one method that returns to me an Observable<CLLocation> every second (distanceFilter == kCLDistanceFilterNone) and another every 30m traveled (distanceFilter == 30). In a very specific case, I noticed a kind of "memory effect" (without fully understanding it yet) when I subscribed to a new 30m stream it returned to me all the data of the last 1Hz stream that I disposed, a few seconds before. It's very strange.

Is this strange behaviour possible there?

public var location: Observable<CLLocation?> 
    let updatedLocation = self.didUpdateLocations.map { $1.last } // <--- possible memory effect here?
    let location =  self.observe(CLLocation.self, .location)
    return Observable.of(location, updatedLocation).merge()
}

Thanks

Narayane avatar Mar 19 '21 09:03 Narayane