memory allocations for libraries used by libvirt
olaf at aepfle.de
Wed May 19 20:30:30 UTC 2021
Currently src/libxl/ allocates a bunch of buffers with variants of g_new0() or g_strdup(), which will be consumed by libxenlight.so. Once the objects which contain these buffers are not needed anymore, libxenlight.so will release them with ordinary calls to free() in its *_dispose() API. In other words: libxenlight.so does not use glib.
While the g_malloc docs of today's glib state that (apparently) the mistake of using a private allocator was recognized and corrected in glib 2.46, the same mistake might occur again in the future.
I wonder if a patch will be accepted which will add simple wrappers around calloc, strdup, like libxlCallocWrap and libxlStrupWrap, which provides the buffers expected by libxenlight.so and which it can simply free() again. Just so that it looks more "symmetric", as opposed to g_new0()/free() pairs.
Maybe this issue was already evaluated at the time libvirt was converted from virAlloc to g_new?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 833 bytes
Desc: Digitale Signatur von OpenPGP
More information about the libvir-list