26#if !defined (_RWSTD_NO_SETRLIMIT)
28# include <sys/resource.h>
32 struct rlimit rl = { limit, limit };
33 setrlimit (RLIMIT_DATA, &rl);
39# define _WIN32_WINNT 0x0500
42# if _WIN32_WINNT >= 0x0500
51 GetSystemInfo (&info);
53 HANDLE hJob = CreateJobObject (
NULL,
NULL);
55 if (AssignProcessToJobObject (hJob, GetCurrentProcess ())) {
56 JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = { 0 };
57 job_info.BasicLimitInformation.LimitFlags =
58 JOB_OBJECT_LIMIT_PROCESS_MEMORY;
59 job_info.ProcessMemoryLimit =
60 limit >
info.dwPageSize ? limit :
info.dwPageSize;
61 SetInformationJobObject (hJob,
62 JobObjectExtendedLimitInformation,
63 &job_info,
sizeof (job_info));
std::ostream & info() noexcept
replacement for std::cout for NeBuild logging.
void limit_memory(unsigned long limit)