Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

[ashell] Adding code to free cb memory and change cleanup order #742

Merged
merged 3 commits into from
Feb 17, 2017

Conversation

brianjjones
Copy link
Contributor

This adds a method that ensures all callbacks are freed. It
also changes the order of some of the cleanup functions to
ensure stability when starting / stopping apps using ashell.

Signed-off-by: Brian J Jones [email protected]

This adds a method that ensures all callbacks are freed.  It
also changes the order of some of the cleanup functions to
ensure stability when starting / stopping apps using ashell.

Signed-off-by: Brian J Jones <[email protected]>
@@ -326,6 +326,15 @@ void zjs_remove_callback(zjs_callback_id id)
}
}

void zjs_remove_all_callback()
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe callbacks?

@grgustaf
Copy link
Contributor

Other than that, LGTM.

{
for (int i = 0; i < cb_size; i++) {
if (cb_map[i]) {
zjs_remove_callback(i);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this code clean up the ringbuffer? maybe @jprestwo can take a look here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, but I don't think ring buffer was the issue I was seeing. cb_map was the item making zjs_malloc calls. Not saying ring buffer couldn't also be an issue however.

@poussa
Copy link
Contributor

poussa commented Feb 16, 2017

I was testing this. It seems to fix the hang issue (#745) or at least improve it significantly. However, there seems to be on new issue, which I guess is in this PR.

Using the sample app from the (#745), on first run you get one callback when you press the button. When you upload the app again (2nd run), you get two callbacks when you press the button. And so on. If you upload the app 10 times, you get 10 callbacks per button press.

But it did not hang!

@brianjjones
Copy link
Contributor Author

@poussa Strange, especially since (in theory) I'm deleting all the callbacks :)

Thanks for trying it out, I'll try and reproduce and fix it so that its a complete fix.

@grgustaf
Copy link
Contributor

+1, @jprestwo has another patch to solve the other problem.

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

Successfully merging this pull request may close these issues.

4 participants