[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'aligned-malloc'
From: |
Jeffrey Walton |
Subject: |
Re: new module 'aligned-malloc' |
Date: |
Wed, 22 Jul 2020 19:07:13 -0400 |
On Wed, Jul 22, 2020 at 6:56 PM Bruno Haible <bruno@clisp.org> wrote:
>
> Hi Paul,
>
> > Of course this performance issue is mostly just for MS-Windows, as other
> > major
> > current platforms already have aligned_alloc or rough equivalent.
>
> No, it's not only Windows. It's
> - macOS
> - Minix
> - native Windows
>
> Here's the complete matrix:
>
> posix_memalign aligned_alloc memalign
>
> glibc Y Y Y
> musl Y Y Y
> macOS - - -
> FreeBSD Y Y -
> NetBSD Y - -
> OpenBSD Y Y -
> AIX Y - -
> HP-UX - - Y
> IRIX - - Y
> Solaris 10 - - Y
> Solaris 11 Y Y -
> Minix - - -
> Haiku Y - Y
> Android Y - Y
> Cygwin Y - Y
> native Windows - - -
This may be helpful for OS X... all pointers returned from malloc(),
calloc() and friends are 16-byte aligned. From the OS X man page:
MALLOC(3) BSD Library Functions Manual MALLOC(3)
NAME
calloc, free, malloc, realloc, reallocf, valloc -- memory allocation
SYNOPSIS
#include <stdlib.h>
void *
calloc(size_t count, size_t size);
void
free(void *ptr);
void *
malloc(size_t size);
void *
realloc(void *ptr, size_t size);
void *
reallocf(void *ptr, size_t size);
void *
valloc(size_t size);
DESCRIPTION
The malloc(), calloc(), valloc(), realloc(), and reallocf() functions
allocate memory. The allocated memory is aligned such that it can be
used for any data type, including AltiVec- and SSE-related types. The
free() function frees allocations that were created via the preceding
allocation functions.
...
Jeff
- Re: new module 'aligned-malloc', (continued)
Re: new module 'aligned-malloc', Paul Eggert, 2020/07/21
- Re: new module 'aligned-malloc', Florian Weimer, 2020/07/21
- Re: new module 'aligned-malloc', Bruno Haible, 2020/07/21
- Re: new module 'aligned-malloc', Paul Eggert, 2020/07/22
- Re: new module 'aligned-malloc', Bruno Haible, 2020/07/22
- Re: new module 'aligned-malloc',
Jeffrey Walton <=
- Re: new module 'aligned-malloc', Paul Eggert, 2020/07/22
- Re: Minix, Bruno Haible, 2020/07/23
Re: new module 'aligned-malloc', Florian Weimer, 2020/07/22
Re: new module 'aligned-malloc', Paul Eggert, 2020/07/22
Re: new module 'aligned-malloc', Florian Weimer, 2020/07/23
Re: new module 'aligned-malloc', Paul Eggert, 2020/07/23
Re: new module 'aligned-malloc', Florian Weimer, 2020/07/23
Re: new module 'aligned-malloc', Bruno Haible, 2020/07/21