Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New app: pace #3565

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

New app: pace #3565

wants to merge 2 commits into from

Conversation

bobrippling
Copy link
Collaborator

This allows a runner to view their current pace and, when paused, splits from their run

@bobrippling
Copy link
Collaborator Author

@gfwilliams @thyttan @atjn I keep seeing memory errors with this but don't believe there's a memory leak in my code, any ideas?

Execution Interrupted during event processing.
Interpreter error: [
  "LOW_MEMORY",
  "MEMORY"
 ]
New interpreter error: LOW_MEMORY,MEMORY

And when I reset:

>reset()
=undefined
FW addr 0x0022afac fail
Status 0
FW addr 0x0022bbb0 fail
Status 0
FW addr 0x0022bbd0 fail
Status 0
FW addr 0x0022bc00 fail
Status 0
Execution Interrupted during event processing.
Interpreter error: [
  "LOW_MEMORY",
  "MEMORY"
 ]

apps/pace/app.ts Outdated
Comment on lines 97 to 98
if (now - lastUnlazy > 30000)
layout.forgetLazyState();
Copy link
Collaborator Author

@bobrippling bobrippling Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if the layout's rects were accumulating, but this doesn't resolve the leak

@thyttan
Copy link
Collaborator

thyttan commented Sep 10, 2024

I'm quite ignorant about the layout module. I suppose its clear function wouldn't help?

@bobrippling
Copy link
Collaborator Author

I'm quite ignorant about the layout module. I suppose its clear function wouldn't help?

Thanks for the quick response! I'm afraid not, that just wipes the layout's part of the screen, but thanks for the suggestion - I'll dig more into the layout module. Although thinking about it, my app isn't using it too differently from others such as rep 🤔

@gfwilliams
Copy link
Member

FW addr 0x0022bc00 fail is itself a bit concerning as that means that the Bangle hasn't been able to write to storage, although looking at it, that's probably caused by the MEMORY error. I'll have to look into that as potentially it could be a cause of storage corruption (if you can find an easy way to reproduce this please let me know!).

The app starts completely blank though and need two button presses just to display anything, so I feel like something's not right anyway.

Maybe run https://github.com/espruino/EspruinoMemView and see if you can visibly see what looks like the issue.

But I just noticed:

while (splitDist_1 >= 1) {
                splits_1.push(thisSplitTime_1());

and at no point does anything seem to take anything out of splits_1 so that looks a hell of a lot like a memory leak to me :)

>splits_1.length
=5597

@gfwilliams
Copy link
Member

By the way, it's interesting that splits has been renamed to splits_1 and so on. Maybe TypeScript has an option not to do that? It feels needlessly wasteful...

@atjn
Copy link
Contributor

atjn commented Sep 11, 2024

The GPS on my watch has never really worked so I unfortunately can't reproduce the issue. On the other hand, that is a pretty good indicator that your problem lies somewhere in the GPS handling. Taking a quick look at the code, my best bet is that you have made a mistake with this loop, which makes it loop infinitely:

for(; ; i++) {
        const split = splits[i + splitOffset];
        if (split == null) break;     
...

@bobrippling
Copy link
Collaborator Author

FW addr 0x0022bc00 fail is itself a bit concerning as that means that the Bangle hasn't been able to write to storage, although looking at it, that's probably caused by the MEMORY error
[...]
if you can find an easy way to reproduce this please let me know!

Shall do - as far as I have seen, running the app as it stands reliably raises the error for me, perhaps the gradual increase in small memory usage (i.e. a number) is what brings it about?

The app starts completely blank though and need two button presses just to display anything, so I feel like something's not right anyway.

Interesting - the app for me starts with an initial split shown, that's quite odd!

Maybe run https://github.com/espruino/EspruinoMemView and see if you can visibly see what looks like the issue.

Didn't know about this, amazing

But I just noticed:

while (splitDist_1 >= 1) {
                splits_1.push(thisSplitTime_1());

and at no point does anything seem to take anything out of splits_1 so that looks a hell of a lot like a memory leak to me :)

>splits_1.length
=5597

I believe this is the issue, I expect my units are wrong, so it's adding to a split once per metre instead of once per K (or similar)

By the way, it's interesting that splits has been renamed to splits_1 and so on. Maybe TypeScript has an option not to do that? It feels needlessly wasteful...

I'll see what I can find


The GPS on my watch has never really worked so I unfortunately can't reproduce the issue. On the other hand, that is a pretty good indicator that your problem lies somewhere in the GPS handling. Taking a quick look at the code, my best bet is that you have made a mistake with this loop, which makes it loop infinetely:

for(; ; i++) {
        const split = splits[i + splitOffset];
        if (split == null) break;     
...

Thanks for the pointer, but this is ok - if we had an issue here we'd see the app hanging since it would be an infinite loop :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants