J
Jean-Michel Hautbois
Hi,
I have a (big) structure, which contains other structures with
(sometimes) big buffers.
Something like :
#define BUF_SIZE 65536
#define BUF_SIZE2 32768
typedef struct {
unsigned char buffer1[BUF_SIZE];
unsigned char buffer2[BUF_SIZE];
} t_buffer_head;
typedef struct {
unsigned char buffer1[BUF_SIZE2];
unsigned char buffer2[BUF_SIZE2];
} t_buffer_subhead;
typedef struct {
t_buffer_head header;
t_buffer_subhead subheader;
} t_buffer_s;
In my use case, I have >100 structures of t_buffer_something and one
big structure of these structures.
I would like, at compile time ideally, or by a static analysis script,
to know the footprint in memory of the big structure (here,
t_buffer_s).
Something like :
t_buffer_s (196608 bytes) :
|__t_buffer_head (131072)
| |__buffer1 (65536)
| |__buffer2 (65536)
|__t_buffer_subhead (65536)
|__buffer1 (32768)
|__buffer2 (32768)
Of course, in case the structure contains pointers, it would likely
indicate it whith a (???) because not knowing the malloc size
associated.
This would be the ideal format, but any approaching solution is
interesting.
Thanks in advance for your advices !
Regards,
JM
I have a (big) structure, which contains other structures with
(sometimes) big buffers.
Something like :
#define BUF_SIZE 65536
#define BUF_SIZE2 32768
typedef struct {
unsigned char buffer1[BUF_SIZE];
unsigned char buffer2[BUF_SIZE];
} t_buffer_head;
typedef struct {
unsigned char buffer1[BUF_SIZE2];
unsigned char buffer2[BUF_SIZE2];
} t_buffer_subhead;
typedef struct {
t_buffer_head header;
t_buffer_subhead subheader;
} t_buffer_s;
In my use case, I have >100 structures of t_buffer_something and one
big structure of these structures.
I would like, at compile time ideally, or by a static analysis script,
to know the footprint in memory of the big structure (here,
t_buffer_s).
Something like :
t_buffer_s (196608 bytes) :
|__t_buffer_head (131072)
| |__buffer1 (65536)
| |__buffer2 (65536)
|__t_buffer_subhead (65536)
|__buffer1 (32768)
|__buffer2 (32768)
Of course, in case the structure contains pointers, it would likely
indicate it whith a (???) because not knowing the malloc size
associated.
This would be the ideal format, but any approaching solution is
interesting.
Thanks in advance for your advices !
Regards,
JM