<p dir="ltr">Why use an array and not a vector or an Hash map?<br>
</p>
<div class="gmail_quote">Am 04.05.2015 22:20 schrieb "Kim Foder" <<a href="mailto:Kim@foder.dk">Kim@foder.dk</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
For some time I have been battling a memory leak in my pedometer app, after a<br>
lot of experimentation, I have found the problem to be my use of arrays<br>
(probably)!<br>
<br>
Whenever I receive an acceleration measurement, some statistical calculations<br>
are made, which results in one float pr. measurement.<br>
<br>
As I need the measurements for a certain time for further statistical<br>
analysis, the results are stored in an array, used as an traveling window like<br>
this:<br>
<br>
accarr.shift();  // the array is pre-initialized with empty elements.<br>
accarr.push(<float>);<br>
<br>
This works great, but it leaks memory fast, and after some time (between 1 & 2<br>
hours) the OS kills all running apps!<br>
<br>
Any ideas how I can solve this?<br>
<br>
Thanks.<br>
<br>
Kim<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br>
</blockquote></div>