STINNER Victor <vstin...@python.org> added the comment:

With the following change, traceback_t size changes from 24 bytes to 32 bytes:

diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index ee32ac29b7..8a820db907 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -79,6 +79,7 @@ __attribute__((packed))
 typedef struct {
     Py_uhash_t hash;
     int nframe;
+    int length;
     frame_t frames[1];
 } traceback_t;
 
@@ -1640,6 +1641,8 @@ PyInit__tracemalloc(void)
     if (tracemalloc_init() < 0)
         return NULL;
 
+    printf("sizeof(traceback_t) = %zu bytes\n", sizeof(traceback_t));
+
     return m;
 }


The following structure size is 24 bytes, so no change:

typedef struct {
    Py_uhash_t hash;
    short nframe;
    short length;
    frame_t frames[1];
} traceback_t;

The short approach is promising :-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37961>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to