This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] record.c - save some memory in record log.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Hui Zhu <teawater at gmail dot com>
- Date: Thu, 15 Oct 2009 12:16:56 -0700
- Subject: Re: [RFA] record.c - save some memory in record log.
- References: <4AD761AD.firstname.lastname@example.org>
> It's based on the observation that the objects that we save
> (registers and small memory writes) are frequently the size of
> a pointer (or smaller). Therefore, instead of allocating both
> a pointer and some malloc memory to hold them, they can simply
> be saved in the space used for the pointer itself.
One way that we have used in the past that might be helpful here
is to define the buffer at the end of the structure and without
the pointer indirection:
The allocation of the structure become a little trickier. And access
to the buffer is a little more dangerous, which is why I don't like
this approach much. But it does save memory, and you can prevent
buffer overrun by forcing access to this data through accessor