@@ -82,6 +82,7 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type,
8282//| ...
8383//|
8484STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__ (mp_obj_t self_in ) {
85+ common_hal_memorymonitor_allocationsize_clear (self_in );
8586 common_hal_memorymonitor_allocationsize_resume (self_in );
8687 return self_in ;
8788}
@@ -99,48 +100,13 @@ STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const m
99100}
100101STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (memorymonitor_allocationsize___exit___obj , 4 , 4 , memorymonitor_allocationsize_obj___exit__ );
101102
102- //| def pause(self) -> None:
103- //| """Pause allocation tracking"""
104- //| ...
105- //|
106- STATIC mp_obj_t memorymonitor_allocationsize_obj_pause (mp_obj_t self_in ) {
107- memorymonitor_allocationsize_obj_t * self = MP_OBJ_TO_PTR (self_in );
108-
109- common_hal_memorymonitor_allocationsize_pause (self );
110- return mp_const_none ;
111- }
112- MP_DEFINE_CONST_FUN_OBJ_1 (memorymonitor_allocationsize_pause_obj , memorymonitor_allocationsize_obj_pause );
113-
114- //| def resume(self) -> None:
115- //| """Resumes allocation tracking."""
116- //| ...
117- //|
118- STATIC mp_obj_t memorymonitor_allocationsize_obj_resume (mp_obj_t self_in ) {
119- common_hal_memorymonitor_allocationsize_resume (self_in );
120- return mp_const_none ;
121- }
122- MP_DEFINE_CONST_FUN_OBJ_1 (memorymonitor_allocationsize_resume_obj , memorymonitor_allocationsize_obj_resume );
123-
124- //| def clear(self) -> Any:
125- //| """Clears all captured pulses"""
126- //| ...
127- //|
128- STATIC mp_obj_t memorymonitor_allocationsize_obj_clear (mp_obj_t self_in ) {
129- memorymonitor_allocationsize_obj_t * self = MP_OBJ_TO_PTR (self_in );
130-
131- common_hal_memorymonitor_allocationsize_clear (self );
132- return mp_const_none ;
133- }
134- MP_DEFINE_CONST_FUN_OBJ_1 (memorymonitor_allocationsize_clear_obj , memorymonitor_allocationsize_obj_clear );
135-
136-
137103//| bytes_per_block: int = ...
138104//| """Number of bytes per block"""
139105//|
140106STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block (mp_obj_t self_in ) {
141107 memorymonitor_allocationsize_obj_t * self = MP_OBJ_TO_PTR (self_in );
142108
143- return mp_obj_new_bool (common_hal_memorymonitor_allocationsize_get_bytes_per_block (self ));
109+ return MP_OBJ_NEW_SMALL_INT (common_hal_memorymonitor_allocationsize_get_bytes_per_block (self ));
144110}
145111MP_DEFINE_CONST_FUN_OBJ_1 (memorymonitor_allocationsize_get_bytes_per_block_obj , memorymonitor_allocationsize_obj_get_bytes_per_block );
146112
0 commit comments