From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsBXp-0007gA-Sw for qemu-devel@nongnu.org; Fri, 20 Jul 2012 07:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsBXo-0004oQ-1Y for qemu-devel@nongnu.org; Fri, 20 Jul 2012 07:38:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsBXn-0004my-Qb for qemu-devel@nongnu.org; Fri, 20 Jul 2012 07:38:51 -0400 Date: Fri, 20 Jul 2012 12:38:30 +0100 From: "Daniel P. Berrange" Message-ID: <20120720113830.GH31455@redhat.com> References: <4FFBD6F1.90403@redhat.com> <20120713091611.GC15503@stefanha-thinkpad.localdomain> <4FFFEF8E.5080705@redhat.com> <50000793.2020401@redhat.com> <5003CDC6.2040103@linux.vnet.ibm.com> <5003CE8B.20804@redhat.com> <500678F7.1030705@linux.vnet.ibm.com> <20120718135846.GE2294@redhat.com> <20120718153543.GK2294@redhat.com> <5007F167.3030602@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5007F167.3030602@redhat.com> Subject: Re: [Qemu-devel] [RFC] introduce a dynamic library to expose qemu block API Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Anthony Liguori , Stefan Hajnoczi , Michael Tokarev , qemu-devel@nongnu.org, =?utf-8?B?TGx1w61z?= , Blue Swirl , Stefan Weil , Hannes Reinecke , Wenchao Xia On Thu, Jul 19, 2012 at 01:37:11PM +0200, Paolo Bonzini wrote: > Il 18/07/2012 17:35, Daniel P. Berrange ha scritto: > > Oh, and will this library depend on glib > > Yes, in all likelihood. > > , and will it have the > > abort-on-oom behaviour QEMU has ? From a libvirt POV, we won't > > use any library that aborts-on-oom. > > Out of curiosity, how do you test OOM? There's two aspects to it. First we forbid use of malloc/free/realloc in favour of an alternative set of APIs designed such that we can get compile time errors when people don't check the result for NULL. http://berrange.com/posts/2008/05/23/better-living-through-api-design-low-level-memory-allocation/ This has been very successful in ensuring code checks for OOM correctly. Second there is a mode in our test suites where you can run under simulated OOM - it runs once to count the total set of mallocs in the test, and then re-run it 'n' times failing each malloc in turn and verifying that we correctly report the OOM error condition. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|