- If cross-compiling platform like ARM, the mmap support will be
disabled directly, which indirectly disabled mempool function, too.
Without mempool, the engine initialization time will be very long
due to memory fragmentation. The fragmentation problem will make
heap grow very fast, and results in using a lot of swap while
running on low RAM machines. It will slow down initialization
and scanning process.
- Test result:
The initialization time of using memory pool on 256MB ARM machine is
faster than without mempool by 5-hour.
... | ... |
@@ -1,3 +1,4 @@ |
1 |
+AC_ARG_ENABLE([mmap-for-cross-compiling],[AS_HELP_STRING([--enable-mmap-for-cross-compiling], [set to "yes" to force enable mmap support without checking under cross-compiling. This could help enable mempool feature.])], enable_mmap_for_cross_compiling=$enableval, mmap_for_cross_compiling="no") |
|
1 | 2 |
dnl Check for mmap() |
2 | 3 |
dnl AC_FUNC_MMAP checks for private fixed mappings, we don't need |
3 | 4 |
dnl fixed mappings, so check only wether private mappings work. |
... | ... |
@@ -67,7 +68,13 @@ int main(void) |
67 | 67 |
}])], |
68 | 68 |
[ac_cv_c_mmap_private=yes], |
69 | 69 |
[ac_cv_c_mmap_private=no], |
70 |
- [ac_cv_c_mmap_private=no])]) |
|
70 |
+ [ |
|
71 |
+ if test $enable_mmap_for_cross_compiling = yes; then |
|
72 |
+ ac_cv_c_mmap_private=yes |
|
73 |
+ else |
|
74 |
+ ac_cv_c_mmap_private=no |
|
75 |
+ fi |
|
76 |
+ ])]) |
|
71 | 77 |
if test $ac_cv_c_mmap_private = yes; then |
72 | 78 |
AC_DEFINE(HAVE_MMAP, 1, |
73 | 79 |
[Define to 1 if you have a working `mmap' system call that supports MAP_PRIVATE.]) |