8000 gc all pointers in hid_devices properly by dhalbert · Pull Request #4798 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

gc all pointers in hid_devices properly #4798

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

Merged
merged 2 commits into from
May 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions shared-module/usb_hid/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,14 @@ void usb_hid_save_report_descriptor(uint8_t *report_descriptor_space, size_t rep
void usb_hid_gc_collect(void) {
gc_collect_ptr(hid_devices_tuple);

// Mark any heap pointers in the static device list as in use.
// Mark possible heap pointers in the static device list as in use.
for (mp_int_t i = 0; i < num_hid_devices; i++) {
gc_collect_ptr(&hid_devices[i]);
// Cast away the const for .report_descriptor. It could be in flash or on the heap.
// Constant report descriptors must be const so that they are used directly from flash
// and not copied into RAM.
gc_collect_ptr((void *)hid_devices[i].report_descriptor);
gc_collect_ptr(hid_devices[i].in_report_buffer);
gc_collect_ptr(hid_devices[i].out_report_buffer);
}
}

Expand Down
0