We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5bdb8c4 commit be8092fCopy full SHA for be8092f
supervisor/shared/memory.c
@@ -125,7 +125,7 @@ supervisor_allocation* allocate_memory(uint32_t length, bool high) {
125
supervisor_allocation* alloc;
126
for (; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index += direction) {
127
alloc = &allocations[index];
128
- if (alloc->length == FREE) {
+ if (alloc->length == FREE && (high_address - low_address) * 4 >= (int32_t) length) {
129
break;
130
}
131
// If a hole matches in length exactly, we can reuse it.
@@ -134,7 +134,7 @@ supervisor_allocation* allocate_memory(uint32_t length, bool high) {
134
return alloc;
135
136
137
- if (index >= CIRCUITPY_SUPERVISOR_ALLOC_COUNT || (high_address - low_address) * 4 < (int32_t) length) {
+ if (index >= CIRCUITPY_SUPERVISOR_ALLOC_COUNT) {
138
return NULL;
139
140
if (high) {
0 commit comments