Skip to content

Glucose Chart

Johan Degraeve edited this page Nov 22, 2020 · 3 revisions

Memory Management Glucose Chart

GlucoseChartManager.swift

The chart stores glucose points in glucoseChartPoints

memory management while user is panning

While user is panning backward, the glucoseChartPoints array will get bigger and bigger, which will slow down the panning. To avoid that, a clean up of the array if a maximum number of elements is stored. This maximum is defined in the constant maximumElementsInGlucoseChartPointsArray:Int When this amount is reached, the array is renewed (ie emptied) and rebuilt with new glucoseChartPoints, depending on where in time the user is currently looking at

This variable is set by testing on an old iPhone SE, seeing when the panning is getting slowed down.

cleanup when receiving memory warning

If the app receives a memory warning, then also a clean up is done In case of memory warning, longer list of variables is set to nil

clean up when going to the background

When the app goes to the background, then also all data in the chartManager is set to nil