mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
detect JEMALLOC_OVERRIDE_MEMALIGN
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
Install autoconf first for jemalloc
|
Install autoconf first for jemalloc
|
||||||
|
|
||||||
```
|
```
|
||||||
|
git clone git@github.com:cloudwu/skynet.git
|
||||||
|
git submodule update --init
|
||||||
|
cd skynet
|
||||||
make 'PLATFORM' # PLATFORM can be linux, macosx, freebsd now
|
make 'PLATFORM' # PLATFORM can be linux, macosx, freebsd now
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
//#include <malloc.h>
|
|
||||||
|
|
||||||
#include "malloc_hook.h"
|
#include "malloc_hook.h"
|
||||||
|
|
||||||
@@ -109,6 +108,8 @@ realloc(void *ptr, size_t size) {
|
|||||||
return fill_prefix(newptr);
|
return fill_prefix(newptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef JEMALLOC_OVERRIDE_MEMALIGN
|
||||||
|
|
||||||
void *
|
void *
|
||||||
memalign(size_t alignment, size_t size) {
|
memalign(size_t alignment, size_t size) {
|
||||||
void *ptr = je_memalign(alignment, size+PREFIX_SIZE);
|
void *ptr = je_memalign(alignment, size+PREFIX_SIZE);
|
||||||
@@ -116,6 +117,8 @@ memalign(size_t alignment, size_t size) {
|
|||||||
return fill_prefix(ptr);
|
return fill_prefix(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
free(void *ptr) {
|
free(void *ptr) {
|
||||||
if (ptr == NULL) return;
|
if (ptr == NULL) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user