From patchwork Thu Aug 26 18:38:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 62799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 59016B70DF for ; Fri, 27 Aug 2010 04:49:18 +1000 (EST) Received: from localhost ([127.0.0.1]:48162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OohRJ-0007oQ-DA for incoming@patchwork.ozlabs.org; Thu, 26 Aug 2010 14:44:41 -0400 Received: from [140.186.70.92] (port=43778 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OohLp-0005AR-NN for qemu-devel@nongnu.org; Thu, 26 Aug 2010 14:39:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OohLo-0006wC-Jn for qemu-devel@nongnu.org; Thu, 26 Aug 2010 14:39:01 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:44249) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OohLo-0006pV-DN for qemu-devel@nongnu.org; Thu, 26 Aug 2010 14:39:00 -0400 Received: by mail-qw0-f45.google.com with SMTP id 5so1984947qwh.4 for ; Thu, 26 Aug 2010 11:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=J4tx8/6vpIxVZQ0bbvofgt068N9NndnSQX8LrokrxzY=; b=dn7ySqzsbt0njJrtwBL/MtTKkCfzdw2VtqYs5ec9jlhJuwxd02YDECCPtizpuhlmGU JQH2OQLjcACUBsEx+51kO2bNAbD8wXMM/d1HeK0ytx7IeWTGzkLQ/vTzSUTWpfUUqxDm AFgaZla1jyEZuEAlJoYqcStm4dPG41mgEhIdk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=CRBJPabthQLc7K3qr+r+p6/xNtuEvHtUABRqCycveZUJRdVhMq6eVTzNtudcxv0jvu IuKjQLKhoHpNRMW+GsYZJcsGHYsdJdh0YhCuyOPucnsn8RHS5p2R0QuDXXgCJI8xYqcp q/o+k2g4Wbunk4OjUQI/KWO1u3nEZkPWUYVuo= Received: by 10.224.6.145 with SMTP id 17mr7008364qaz.140.1282847940181; Thu, 26 Aug 2010 11:39:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.183.135 with HTTP; Thu, 26 Aug 2010 11:38:40 -0700 (PDT) From: Blue Swirl Date: Thu, 26 Aug 2010 18:38:40 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 3/5] HACKING: add memory management rules X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add memory management rules, somewhat like libvirt HACKING. Signed-off-by: Blue Swirl --- HACKING | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) +emulators. diff --git a/HACKING b/HACKING index 19fc874..554009e 100644 --- a/HACKING +++ b/HACKING @@ -72,3 +72,14 @@ Typedefs are used to eliminate the redundant 'struct' keyword. 2.4. Reserved namespaces in C Underscore capital, double underscore, and underscore 't' suffixes should be avoided. + +3. Low level memory management + +Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign +APIs is not allowed in the QEMU codebase. Instead of these routines, +use the replacement qemu_malloc/qemu_mallocz/qemu_realloc/qemu_free or +qemu_vmalloc/qemu_memalign/qemu_vfree APIs. + +Memory allocated by qemu_vmalloc or qemu_memalign must be freed with +qemu_vfree, since breaking this will cause problems on Win32 and user