Skip to content

Commit

Permalink
Reduce only-for-malloc area from 160k to 108k (#1794)
Browse files Browse the repository at this point in the history
For non-SPIRAM ESP32s, this increases the size of the heap metadata from
12k to 16k, but may help for systems that have large Toit heaps and low
amounts of malloced memory.
  • Loading branch information
Erik Corry authored Sep 5, 2023
1 parent d25922d commit f2ab40a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/third_party/dartino/gc_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ void GcMetadata::set_up_singleton() {
lowest_address_ = Utils::round_down(range_address, TOIT_PAGE_SIZE);
uword size = Utils::round_up(range.size + range_address - lowest_address_, TOIT_PAGE_SIZE);
#ifdef TOIT_FREERTOS
// Assume that the first 160k of memory can be used for C allocations, so we
// Assume that the first 108k of memory can be used for C allocations, so we
// remove that from the area that needs to be covered by the heap metadata.
// This reduces the heap metadata from 24k or 28k to 12k or 16k.
const uword ONLY_FOR_MALLOC = 160 * KB;
// This reduces the heap metadata from 24k or 28k to 16k.
const uword ONLY_FOR_MALLOC = 108 * KB;
const uword TWELVE_K_METADATA_LIMIT = 148 * KB;
const uword SIXTEEN_K_METADATA_LIMIT = 200 * KB;
if (!OS::use_spiram_for_metadata() && !OS::use_spiram_for_heap()) {
Expand Down

0 comments on commit f2ab40a

Please sign in to comment.