Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#include <malloc.h> -- Xcode

I have an interesting problem where I can't include malloc.h in my project.

I need malloc.h for Paul Nettle's mmgr tool (I'm not keen on using instruments)

Problem is I can't find the system library for memalign.

Xcode keeps failing because it cannot this definition & neither can I.

Anyone else seen this?!

like image 277
Ryan Avatar asked May 08 '11 19:05

Ryan


1 Answers

If you just need to use malloc then you can grab it from the stdlib like so:

#include <stdlib.h>

Otherwise, you can directly call malloc.h like so:

#include <malloc/malloc.h>

EDIT:

A posix_memalign() exists in stdlib.h. The implementation looks like:

int posix_memalign(void **, size_t, size_t);

Perhaps you can make an alias to this and use it?

like image 183
KushalP Avatar answered Sep 22 '22 09:09

KushalP