From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: malloc and alignment Date: Mon, 16 Jun 2003 19:11:24 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200306162311.h5GNBPG2024716@rum.cs.yale.edu> References: <200306161438.h5GEcodM011551@rum.cs.yale.edu> <20030616223526.GA8010@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1055805091 29015 80.91.224.249 (16 Jun 2003 23:11:31 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Jun 2003 23:11:31 +0000 (UTC) Cc: Stefan Monnier Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Jun 17 01:11:27 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19S38J-0007XT-00 for ; Tue, 17 Jun 2003 01:11:27 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19S3Vw-0001i5-00 for ; Tue, 17 Jun 2003 01:35:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19S39n-00026r-K7 for emacs-devel@quimby.gnus.org; Mon, 16 Jun 2003 19:12:59 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19S397-0001ma-Ua for emacs-devel@gnu.org; Mon, 16 Jun 2003 19:12:17 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19S38x-0001ck-VE for emacs-devel@gnu.org; Mon, 16 Jun 2003 19:12:08 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19S38H-0001BQ-Nj; Mon, 16 Jun 2003 19:11:25 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h5GNBP0i024718; Mon, 16 Jun 2003 19:11:25 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h5GNBPG2024716; Mon, 16 Jun 2003 19:11:25 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Miles Bader Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15141 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15141 > > So all we need is to make sure that those 8KB are properly aligned. > > But how can I do that ? > > It seems the only reliable way is to malloc 16KB and then waste > > the 8KB that happen to be before/after the aligned part. > > > > Should I just wrap malloc in my own malloc_aligned such that > > malloc_aligned calls malloc to allocate chunks of say 1MB > > and then gives them out in aligned packets of 8KB ? > > You could use `memalign'.... How standard is it ? Stefan