Ticket Created
over 3 years ago

CIQQA-1287

Memory leak in LocalMoment

For my testing simulator I'm replaying GPX track files generated by test users around the world. (using my app's replay code, not the Activity Data playback)

My app's internal clock is synchronised with the (GPS) timestamp in Position.getInfo().when.value().

Until now, I had used Gregorian.info to format the time for display, but when replaying a track from a different timezone or DST time,  it was displaying the time in my timezone and DST so it was hard to interpret.

I recently discovered LocalMoment which, after some hassles, did the perfect job:

 timestruct = Gregorian.info(Gregorian.localMoment( simulator.mLocation, timeSecs) , Time.FORMAT_SHORT);

However, the app crashed out of memory when running in the sim, and I have discovered there's a memory leak from Gregorian.localMoment of around 200 bytes per call. and since I make the call on every 1-sec cycle, after around 50 mins running in my sim I have blown 700K memory of the Epix 2 test target.

PS I can't imagine how this piece of code determines the timezone and Daylight Saving schedule based on the lat/lon and timestamp, but it does appear so to do, and is amazing! I just wish I could use it!

[EDIT] OK, I can use it, by retrieving and storing the timezone once from an initial call. But still the memory leak needs to be fixed.