Re: Redesigning Libvirt: Adopting use of a safe language

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 15, 2017 at 02:59:20PM +0000, Daniel P. Berrange wrote:
> On Wed, Nov 15, 2017 at 12:28:30PM +0100, Bjoern Walk wrote:
> > Why has there never been a truly satisfying standard library for C for
> > this kind of stuff? If such a project would exist, this wheel
> > re-inventing would be prevented while providing a higher-quality code
> > for platform library code.
> 
> There are countless "standard" libraries all with their own quirks. Many
> of them don't even really address the core safety problems. eg we could
> consider glib2 for libvirt, but it just replicates the same awful unsafe
> malloc API style that the stdc lib has, with marginal improvement.

I think you should look at pool allocators.  I really wish I'd used
one in libguestfs ...  Pool allocators give you a nice middle ground
between using C and having something which looks and feels a lot like
garbage collection.

Pool allocators also fit nicely to servers because it's natural to
create a new pool for each request and then free everything in the
pool at the end of the request.  You can also attach pools to other
concepts (in libvirtd that would include per-VM pools).

Luckily there is now a widely available pool allocator (widely
available because it's used/required by SAMBA):

  https://talloc.samba.org/talloc/doc/html/index.html

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux