-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
gc_alloc() - should collected=1 after gc_collect() is executed? #3786
Comments
Yes, that looks to be a correct conclusion. |
Fixed by 6bd7874 |
tannewt
added a commit
to tannewt/circuitpython
that referenced
this issue
Dec 8, 2020
This changes lots of files to unify `board.h` across ports. It adds `board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to deinit the board before deep sleeping (even when pretending.) Deep sleep is now a two step process for the port. First, the port should prepare to deep sleep based on the given alarms. It should set alarms for both deep and pretend sleep. In particular, the pretend versions should be set immediately so that we don't miss an alarm as we shutdown. These alarms should also wake from `port_idle_until_interrupt` which is used when pretending to deep sleep. Second, when real deep sleeping, `alarm_enter_deep_sleep` is called. The port should set any alarms it didn't during prepare based on data it saved internally during prepare. ESP32-S2 sleep is a bit reorganized to locate more logic with TimeAlarm. This will help it scale to more alarm types. Fixes micropython#3786
tannewt
added a commit
to tannewt/circuitpython
that referenced
this issue
Dec 8, 2020
This changes lots of files to unify `board.h` across ports. It adds `board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to deinit the board before deep sleeping (even when pretending.) Deep sleep is now a two step process for the port. First, the port should prepare to deep sleep based on the given alarms. It should set alarms for both deep and pretend sleep. In particular, the pretend versions should be set immediately so that we don't miss an alarm as we shutdown. These alarms should also wake from `port_idle_until_interrupt` which is used when pretending to deep sleep. Second, when real deep sleeping, `alarm_enter_deep_sleep` is called. The port should set any alarms it didn't during prepare based on data it saved internally during prepare. ESP32-S2 sleep is a bit reorganized to locate more logic with TimeAlarm. This will help it scale to more alarm types. Fixes micropython#3786
tannewt
added a commit
to tannewt/circuitpython
that referenced
this issue
Dec 8, 2020
This changes lots of files to unify `board.h` across ports. It adds `board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to deinit the board before deep sleeping (even when pretending.) Deep sleep is now a two step process for the port. First, the port should prepare to deep sleep based on the given alarms. It should set alarms for both deep and pretend sleep. In particular, the pretend versions should be set immediately so that we don't miss an alarm as we shutdown. These alarms should also wake from `port_idle_until_interrupt` which is used when pretending to deep sleep. Second, when real deep sleeping, `alarm_enter_deep_sleep` is called. The port should set any alarms it didn't during prepare based on data it saved internally during prepare. ESP32-S2 sleep is a bit reorganized to locate more logic with TimeAlarm. This will help it scale to more alarm types. Fixes micropython#3786
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
micropython/py/gc.c
Lines 452 to 458 in 1b7487e
If a
gc_collect()
is performed here then why isn'tcollected
set to1
just like it is in the next code block?micropython/py/gc.c
Lines 471 to 479 in 1b7487e
Under existing code, it seems you would
gc_collect()
(from L455)gc_collect()
which would be 100% pointless because no allocation operation was performed between step 2 and step 3 so it's guaranteed the memory layout hasn't changed.collected = 1
gc_collect()
was called on L455return NULL
By adding
collected = 1
at L455, we'd be avoiding an extragc_collect()
+ search.The text was updated successfully, but these errors were encountered: