-
Notifications
You must be signed in to change notification settings - Fork 64
[ashell] Adding code to free cb memory and change cleanup order #742
Conversation
8228fde
to
b52054b
Compare
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]>
b52054b
to
47e93b1
Compare
src/zjs_callbacks.c
Outdated
@@ -326,6 +326,15 @@ void zjs_remove_callback(zjs_callback_id id) | |||
} | |||
} | |||
|
|||
void zjs_remove_all_callback() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe callbacks?
Other than that, LGTM. |
{ | ||
for (int i = 0; i < cb_size; i++) { | ||
if (cb_map[i]) { | ||
zjs_remove_callback(i); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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! |
@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. |
+1, @jprestwo has another patch to solve the other problem. |
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]