Skip to content

Commit 91cf8fb

Browse files
committed
Make collect the default
1 parent 35ffb64 commit 91cf8fb

File tree

78 files changed

+149
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+149
-188
lines changed

extmod/modasyncio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ mp_obj_t mp_asyncio_context = MP_OBJ_NULL;
179179

180180
static mp_obj_t task_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
181181
mp_arg_check_num(n_args, n_kw, 1, 2, false);
182-
// CIRCUITPY-CHANGE: Task holds onto core and data so collect it.
183-
mp_obj_task_t *self = m_malloc_with_collect(sizeof(mp_obj_task_t));
182+
mp_obj_task_t *self = m_new_obj(mp_obj_task_t);
184183
self->pairheap.base.type = type;
185184
mp_pairheap_init_node(task_lt, &self->pairheap);
186185
self->coro = args[0];

extmod/vfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args
237237
}
238238

239239
// create new object
240-
// CIRCUITPY-CHANGE: Collect the mount object because it references others
241-
mp_vfs_mount_t *vfs = m_malloc_with_collect(sizeof(mp_vfs_mount_t));
240+
mp_vfs_mount_t *vfs = m_new_obj(mp_vfs_mount_t);
242241
vfs->str = mnt_str;
243242
vfs->len = mnt_len;
244243
vfs->obj = vfs_obj;

ports/atmel-samd/common-hal/pulseio/PulseIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self,
130130
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
131131
}
132132

133-
self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t));
133+
self->buffer = (uint16_t *)m_malloc_without_collect(maxlen * sizeof(uint16_t));
134134
if (self->buffer == NULL) {
135135
m_malloc_fail(maxlen * sizeof(uint16_t));
136136
}

ports/cxd56/common-hal/pulseio/PulseIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int pulsein_interrupt_handler(int irq, FAR void *context, FAR void *arg)
6565

6666
void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self,
6767
const mcu_pin_obj_t *pin, uint16_t maxlen, bool idle_state) {
68-
self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t));
68+
self->buffer = (uint16_t *)m_malloc_without_collect(maxlen * sizeof(uint16_t));
6969
if (self->buffer == NULL) {
7070
m_malloc_fail(maxlen * sizeof(uint16_t));
7171
}

ports/espressif/common-hal/_bleio/Characteristic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self,
7878
// If max_length is 0, then no storage is allocated.
7979
if (max_length > 0) {
8080
if (gc_alloc_possible()) {
81-
self->current_value = m_malloc(max_length);
81+
self->current_value = m_malloc_without_collect(max_length);
8282
} else {
8383
self->current_value = port_malloc(max_length, false);
8484
if (self->current_value == NULL) {

ports/espressif/common-hal/_bleio/CharacteristicBuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe
5454
bleio_characteristic_obj_t *characteristic,
5555
mp_float_t timeout,
5656
size_t buffer_size) {
57-
uint8_t *buffer = m_malloc(buffer_size);
57+
uint8_t *buffer = m_malloc_without_collect(buffer_size);
5858
_common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL, false);
5959
}
6060

ports/espressif/common-hal/_bleio/PacketBuffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,17 @@ void common_hal_bleio_packet_buffer_construct(
240240
uint32_t *incoming_buffer = NULL;
241241
if (incoming) {
242242
incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size);
243-
incoming_buffer = m_malloc(incoming_buffer_size);
243+
incoming_buffer = m_malloc_without_collect(incoming_buffer_size);
244244
}
245245

246246
uint32_t *outgoing1 = NULL;
247247
uint32_t *outgoing2 = NULL;
248248
if (outgoing) {
249-
outgoing1 = m_malloc(max_packet_size);
249+
outgoing1 = m_malloc_without_collect(max_packet_size);
250250
// Only allocate the second buffer if we are doing writes with responses.
251251
// Without responses, we just write as quickly as we can.
252252
if (outgoing == CHAR_PROP_WRITE || outgoing == CHAR_PROP_INDICATE) {
253-
outgoing2 = m_malloc(max_packet_size);
253+
outgoing2 = m_malloc_without_collect(max_packet_size);
254254
}
255255
}
256256
_common_hal_bleio_packet_buffer_construct(self, characteristic,

ports/espressif/common-hal/_bleio/ble_events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void ble_event_add_handler(ble_gap_event_fn *func, void *param) {
6464
}
6565

6666
// Add a new handler to the front of the list
67-
ble_event_handler_entry_t *handler = m_new(ble_event_handler_entry_t, 1);
67+
ble_event_handler_entry_t *handler = m_new_obj(ble_event_handler_entry_t);
6868
ble_event_add_handler_entry(handler, func, param);
6969
}
7070

ports/espressif/common-hal/audioio/AudioOut.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static bool audioout_convert_u8s_u8m(
4242

4343
bool buffer_changed = false;
4444
if (in_buffer_size / 2 > *out_buffer_size) {
45-
*out_buffer = m_malloc(in_buffer_size / 2);
45+
*out_buffer = m_malloc_without_collect(in_buffer_size / 2);
4646
buffer_changed = true;
4747
}
4848
audiosample_convert_u8s_u8m(*out_buffer, (uint8_t *)in_buffer, in_buffer_size / 2);
@@ -58,7 +58,7 @@ static bool audioout_convert_u8m_u8s(
5858

5959
bool buffer_changed = false;
6060
if (in_buffer_size * 2 > *out_buffer_size) {
61-
*out_buffer = m_malloc(in_buffer_size * 2);
61+
*out_buffer = m_malloc_without_collect(in_buffer_size * 2);
6262
buffer_changed = true;
6363
}
6464
audiosample_convert_u8m_u8s(*out_buffer, (uint8_t *)in_buffer, in_buffer_size);
@@ -74,7 +74,7 @@ static bool audioout_convert_s8m_u8m(
7474

7575
bool buffer_changed = false;
7676
if (in_buffer_size > *out_buffer_size) {
77-
*out_buffer = m_malloc(in_buffer_size);
77+
*out_buffer = m_malloc_without_collect(in_buffer_size);
7878
buffer_changed = true;
7979
}
8080
audiosample_convert_s8m_u8m(*out_buffer, (int8_t *)in_buffer, in_buffer_size);
@@ -90,7 +90,7 @@ static bool audioout_convert_s8s_u8m(
9090

9191
bool buffer_changed = false;
9292
if (in_buffer_size / 2 > *out_buffer_size) {
93-
*out_buffer = m_malloc(in_buffer_size / 2);
93+
*out_buffer = m_malloc_without_collect(in_buffer_size / 2);
9494
buffer_changed = true;
9595
}
9696
audiosample_convert_s8s_u8m(*out_buffer, (int8_t *)in_buffer, in_buffer_size / 2);
@@ -106,7 +106,7 @@ static bool audioout_convert_s8m_u8s(
106106

107107
bool buffer_changed = false;
108108
if (in_buffer_size * 2 > *out_buffer_size) {
109-
*out_buffer = m_malloc(in_buffer_size * 2);
109+
*out_buffer = m_malloc_without_collect(in_buffer_size * 2);
110110
buffer_changed = true;
111111
}
112112
audiosample_convert_s8m_u8s(*out_buffer, (int8_t *)in_buffer, in_buffer_size);
@@ -122,7 +122,7 @@ static bool audioout_convert_s8s_u8s(
122122

123123
bool buffer_changed = false;
124124
if (in_buffer_size > *out_buffer_size) {
125-
*out_buffer = m_malloc(in_buffer_size);
125+
*out_buffer = m_malloc_without_collect(in_buffer_size);
126126
buffer_changed = true;
127127
}
128128
audiosample_convert_s8s_u8s(*out_buffer, (int8_t *)in_buffer, in_buffer_size);
@@ -138,7 +138,7 @@ static bool audioout_convert_u16m_u8m(
138138

139139
bool buffer_changed = false;
140140
if (in_buffer_size / 2 > *out_buffer_size) {
141-
*out_buffer = m_malloc(in_buffer_size / 2);
141+
*out_buffer = m_malloc_without_collect(in_buffer_size / 2);
142142
buffer_changed = true;
143143
}
144144
audiosample_convert_u16m_u8m(*out_buffer, (uint16_t *)in_buffer, in_buffer_size / 2);
@@ -154,7 +154,7 @@ static bool audioout_convert_u16m_u8s(
154154

155155
bool buffer_changed = false;
156156
if (in_buffer_size > *out_buffer_size) {
157-
*out_buffer = m_malloc(in_buffer_size);
157+
*out_buffer = m_malloc_without_collect(in_buffer_size);
158158
buffer_changed = true;
159159
}
160160
audiosample_convert_u16m_u8s(*out_buffer, (uint16_t *)in_buffer, in_buffer_size / 2);
@@ -186,7 +186,7 @@ static bool audioout_convert_u16s_u8s(
186186

187187
bool buffer_changed = false;
188188
if (in_buffer_size / 2 > *out_buffer_size) {
189-
*out_buffer = m_malloc(in_buffer_size / 2);
189+
*out_buffer = m_malloc_without_collect(in_buffer_size / 2);
190190
buffer_changed = true;
191191
}
192192
audiosample_convert_u16s_u8s(*out_buffer, (uint16_t *)in_buffer, in_buffer_size / 4);
@@ -202,7 +202,7 @@ static bool audioout_convert_s16m_u8m(
202202

203203
bool buffer_changed = false;
204204
if (in_buffer_size / 2 > *out_buffer_size) {
205-
*out_buffer = m_malloc(in_buffer_size / 2);
205+
*out_buffer = m_malloc_without_collect(in_buffer_size / 2);
206206
buffer_changed = true;
207207
}
208208
audiosample_convert_s16m_u8m(*out_buffer, (int16_t *)in_buffer, in_buffer_size / 2);
@@ -218,7 +218,7 @@ static bool audioout_convert_s16m_u8s(
218218

219219
bool buffer_changed = false;
220220
if (in_buffer_size > *out_buffer_size) {
221-
*out_buffer = m_malloc(in_buffer_size);
221+
*out_buffer = m_malloc_without_collect(in_buffer_size);
222222
buffer_changed = true;
223223
}
224224
audiosample_convert_s16m_u8s(*out_buffer, (int16_t *)in_buffer, in_buffer_size / 2);
@@ -250,7 +250,7 @@ static bool audioout_convert_s16s_u8s(
250250

251251
bool buffer_changed = false;
252252
if (in_buffer_size / 2 > *out_buffer_size) {
253-
*out_buffer = m_malloc(in_buffer_size / 2);
253+
*out_buffer = m_malloc_without_collect(in_buffer_size / 2);
254254
buffer_changed = true;
255255
}
256256
audiosample_convert_s16s_u8s(*out_buffer, (int16_t *)in_buffer, in_buffer_size / 4);

ports/espressif/common-hal/nvm/ByteArray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static esp_err_t get_bytes(nvs_handle_t handle, uint8_t **buf_out) {
4646
*buf_out = NULL;
4747
return result;
4848
}
49-
buf = m_malloc(size); // this SHOULD be the same as
49+
buf = m_malloc_without_collect(size); // this SHOULD be the same as
5050
if (result == ESP_OK) {
5151
result = nvs_get_blob(handle, "data", buf, &size);
5252
} else {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy