On Wed, Mar 21, 2007 at 10:31:41AM -0400, Daniel Veillard wrote:
On Wed, Mar 21, 2007 at 01:55:35PM +0000, Mark McLoughlin wrote:
> - I think the use case is a little different - generally in libvirt,
> we're only allocating very small chunks where the CPU hit for
> initialisation would be negligible and would never show up on a
> profile. I'd prefer to take the minor hit of zero-initialising
> most/all memory for programming ease.
>
> - If our wrappers always zero-initialise, we don't need the
> "initialise to -1 when debugging" thing.
>
> - If we rely on calloc() zero-initialising in our wrappers, we give
> opportunity for libc to optimise where it knows the memory is
> already initialised - e.g. where it's mmap()ing the memory
> from /dev/zero
okay, okay, let's use calloc() for libvirt, but then there is a number of
places where I probably used memset() for zeroing, they should all be cleaned
up.
Patch enclosed, it also fixes a couple of places in virsh.c where
malloc() and calloc() were called directly instead of using the virsh
checking functions.
Daniel
--
Red Hat Virtualization group
http://redhat.com/virtualization/
Daniel Veillard | virtualization library
http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine
http://rpmfind.net/