[Spice-devel] [PATCH spice-server v2 00/23] Use GLib memory allocation

Matthew Francis mjay.francis at gmail.com
Wed Sep 20 14:17:43 UTC 2017


On 20 September 2017 at 20:54, Christophe de Dinechin
<cdupontd at redhat.com> wrote:
>
>> On 20 Sep 2017, at 11:53, Frediano Ziglio <fziglio at redhat.com> wrote:

>> There are many tools to instruments memory allocations and is not hard
>> to write one on your own. For instance knowing that objects file takes
>> precedence over libraries you can write a module defining malloc, or use
>> --wrap linker option or LD_PRELOAD.
>
> That works if you want to instrument all malloc calls. If you want to do
> something specific to spice, you can’t do that.

Valgrind, for one, can easily provide information on allocations by
calling function - both for leak checking (the "memcheck" tool) and
heap usage profiling (the "massif" tool).

There's apparently even a simple way to slip it under an existing QEMU
VM from libvirt; there is a recipe for that in this presentation:
https://www.linux-kvm.org/images/d/d2/03x07-Valgrind.pdf

Regards
Matthew Francis


More information about the Spice-devel mailing list