Skip to content

A few heap related tweaks#985

Merged
dhalbert merged 9 commits into
adafruit:masterfrom
tannewt:heap_tweaks3
Jul 9, 2018
Merged

A few heap related tweaks#985
dhalbert merged 9 commits into
adafruit:masterfrom
tannewt:heap_tweaks3

Conversation

@tannewt
Copy link
Copy Markdown
Member

@tannewt tannewt commented Jul 3, 2018

  • Long live byte strings
  • Long live code.py code
  • Collect after import
  • Limit max QSTR pool size

tannewt added 8 commits July 3, 2018 05:45
This prevents bugs where gc_collect is called from C code that did
a recent allocation.
Imports generate a lot of garbage so cleaning it up immediately
reduces the likelihood longer lived data structures don't end up in
the middle of the heap.

Fixes micropython#856
@tannewt
Copy link
Copy Markdown
Member Author

tannewt commented Jul 3, 2018

Travis is testing nrf fix.

In the meantime I forgot to post the videos:

before: https://www.youtube.com/watch?v=dabIOpBfnks
after: https://www.youtube.com/watch?v=Q_hXDPc1L8Q

dhalbert
dhalbert previously approved these changes Jul 3, 2018
Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

This is great!! Should make larger programs more feasible in many cases.

Comment thread ports/nrf/Makefile Outdated

OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(BUILD)/pins_gen.o
OBJ += $(BUILD)/pins_gen.o supervisor/cpu.o
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Adding a SRC_S variable and then using addprefix to change to .o would probably be cleaner :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done. Thanks for the comment

Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Want to do SRC_S in atmel-samd/Makefile too?

Comment thread ports/atmel-samd/Makefile
$(addprefix shared-module/, $(SRC_SHARED_MODULE))

SRC_O = supervisor/$(CHIP_FAMILY)_cpu.o

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same thing here that you did in the nrf makefile?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done! Please take another look.

@tannewt
Copy link
Copy Markdown
Member Author

tannewt commented Jul 9, 2018

@dhalbert Please take a look!

Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Sorry, somehow I missed your changes from 3 days ago! Looks great!

@dhalbert dhalbert merged commit 64b9ee9 into adafruit:master Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants