mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-06 18:20:17 +00:00
[no ci] fix
This commit is contained in:
parent
061206f13e
commit
d11967293f
@ -41,7 +41,7 @@ static void ManagedHeap__fire_debug_callback(ManagedHeap* self, ManagedHeapSwpet
|
|||||||
c11_sbuf__ctor(&buf);
|
c11_sbuf__ctor(&buf);
|
||||||
|
|
||||||
const clock_t CLOCKS_PER_MS = CLOCKS_PER_SEC / 1000;
|
const clock_t CLOCKS_PER_MS = CLOCKS_PER_SEC / 1000;
|
||||||
const char* DIVIDER = "------------------------------";
|
const char* DIVIDER = "------------------------------------------------------------\n";
|
||||||
|
|
||||||
clock_t start = out_info->start / CLOCKS_PER_MS;
|
clock_t start = out_info->start / CLOCKS_PER_MS;
|
||||||
clock_t mark_ms = (out_info->mark_end - out_info->start) / CLOCKS_PER_MS;
|
clock_t mark_ms = (out_info->mark_end - out_info->start) / CLOCKS_PER_MS;
|
||||||
@ -58,6 +58,7 @@ static void ManagedHeap__fire_debug_callback(ManagedHeap* self, ManagedHeapSwpet
|
|||||||
pk_sprintf(&buf, "large_freed: %d\n", out_info->large_freed);
|
pk_sprintf(&buf, "large_freed: %d\n", out_info->large_freed);
|
||||||
c11_sbuf__write_cstr(&buf, DIVIDER);
|
c11_sbuf__write_cstr(&buf, DIVIDER);
|
||||||
|
|
||||||
|
if(out_info->small_freed != 0 || out_info->large_freed != 0) {
|
||||||
char line_buf[256];
|
char line_buf[256];
|
||||||
for(int i = 0; i < out_info->types_length; i++) {
|
for(int i = 0; i < out_info->types_length; i++) {
|
||||||
const char* type_name = py_tpname(i);
|
const char* type_name = py_tpname(i);
|
||||||
@ -73,6 +74,8 @@ static void ManagedHeap__fire_debug_callback(ManagedHeap* self, ManagedHeapSwpet
|
|||||||
c11_sbuf__write_cstr(&buf, line_buf);
|
c11_sbuf__write_cstr(&buf, line_buf);
|
||||||
}
|
}
|
||||||
c11_sbuf__write_cstr(&buf, DIVIDER);
|
c11_sbuf__write_cstr(&buf, DIVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
pk_sprintf(&buf, "auto_thres.before: %d\n", out_info->auto_thres.before);
|
pk_sprintf(&buf, "auto_thres.before: %d\n", out_info->auto_thres.before);
|
||||||
pk_sprintf(&buf, "auto_thres.after: %d\n", out_info->auto_thres.after);
|
pk_sprintf(&buf, "auto_thres.after: %d\n", out_info->auto_thres.after);
|
||||||
pk_sprintf(&buf, "auto_thres.upper: %d\n", out_info->auto_thres.upper);
|
pk_sprintf(&buf, "auto_thres.upper: %d\n", out_info->auto_thres.upper);
|
||||||
@ -141,6 +144,11 @@ int ManagedHeap__collect(ManagedHeap* self) {
|
|||||||
int freed = ManagedHeap__sweep(self, out_info);
|
int freed = ManagedHeap__sweep(self, out_info);
|
||||||
if(out_info) out_info->swpet_end = clock();
|
if(out_info) out_info->swpet_end = clock();
|
||||||
|
|
||||||
|
if(out_info) {
|
||||||
|
out_info->auto_thres.before = self->gc_threshold;
|
||||||
|
out_info->auto_thres.after = self->gc_threshold;
|
||||||
|
}
|
||||||
|
|
||||||
if(self->debug_callback) {
|
if(self->debug_callback) {
|
||||||
ManagedHeap__fire_debug_callback(self, out_info);
|
ManagedHeap__fire_debug_callback(self, out_info);
|
||||||
ManagedHeapSwpetInfo__delete(out_info);
|
ManagedHeapSwpetInfo__delete(out_info);
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
import gc
|
import gc
|
||||||
|
from pkpy import setup_gc_debug_callback
|
||||||
|
|
||||||
|
setup_gc_debug_callback(print)
|
||||||
|
|
||||||
|
gc.collect()
|
||||||
def create_garbage():
|
def create_garbage():
|
||||||
a = [(1,2) for i in range(10000)]
|
a = [(1,2) for i in range(10000)]
|
||||||
return a
|
return a
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user