mirror of https://github.com/vitalif/openscad
Implemented stackLimit() for Mac OS X
parent
d8010a0659
commit
15835271c2
|
@ -20,6 +20,18 @@ std::string PlatformUtils::userConfigPath()
|
|||
|
||||
unsigned long PlatformUtils::stackLimit()
|
||||
{
|
||||
struct rlimit limit;
|
||||
|
||||
int ret = getrlimit(RLIMIT_STACK, &limit);
|
||||
if (ret == 0) {
|
||||
if (limit.rlim_cur > STACK_BUFFER_SIZE) {
|
||||
return limit.rlim_cur - STACK_BUFFER_SIZE;
|
||||
}
|
||||
if (limit.rlim_max > STACK_BUFFER_SIZE) {
|
||||
return limit.rlim_max - STACK_BUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
return STACK_LIMIT_DEFAULT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue