--- orig/o/alloc.c +++ mod/o/alloc.c @@ -732,7 +732,19 @@ if (initialized) return; initialized=1; - + +#if defined(BSD) && defined(RLIMIT_STACK) + /* Maybe the soft limit for data segment size is lower than the + * hard limit. In that case, we want as much as possible. + */ + getrlimit(RLIMIT_DATA, &data_rlimit); + if (data_rlimit.rlim_cur != RLIM_INFINITY && + (data_rlimit.rlim_max == RLIM_INFINITY || + data_rlimit.rlim_max > data_rlimit.rlim_cur)) { + data_rlimit.rlim_cur = data_rlimit.rlim_max; + setrlimit(RLIMIT_DATA, &data_rlimit); + } +#endif #ifndef DONT_NEED_MALLOC