Memory Allocation - FFTW 3.2.2
Description: FFTW 3.2.2

Previous: Precision, Up: Data Types and Files

#### 4.1.3 Memory Allocation

         void *fftw_malloc(size_t n);
         void fftw_free(void *p);

These are functions that behave identically to `malloc` and `free`, except that they guarantee that the returned pointer obeys any special alignment restrictions imposed by any algorithm in FFTW (e.g. for SIMD acceleration). See Data Alignment. Data allocated by `fftw_malloc` must be deallocated by `fftw_free` and not by the ordinary `free`.

These routines simply call through to your operating system's `malloc` or, if necessary, its aligned equivalent (e.g. `memalign`), so you normally need not worry about any significant time or space overhead. You are not required to use them to allocate your data, but we strongly recommend it.

Note: in C++, just as with ordinary `malloc`, you must typecast the output of `fftw_malloc` to whatever pointer type you are allocating.