Partial patch by upstream to fix compilation on platforms without posix_madvise. http://vcs.pcre.org/viewvc/code/trunk/sljit/sljitUtils.c?r1=952&r2=987&pathrev=987O --- code/trunk/sljit/sljitUtils.c 2012/03/16 12:59:30 952 +++ code/trunk/sljit/sljitUtils.c 2012/07/07 04:11:29 987 @@ -106,7 +106,7 @@ #else /* _WIN32 */ -#include "pthread.h" +#include #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR) @@ -262,8 +262,14 @@ } aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align; aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align; + /* If madvise is available, we release the unnecessary space. */ +#if defined(POSIX_MADV_DONTNEED) if (aligned_new_limit < aligned_old_limit) posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED); +#elif defined(MADV_DONTNEED) + if (aligned_new_limit < aligned_old_limit) + madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED); +#endif stack->limit = new_limit; return 0; #endif