Commit d2aa36f5 by Rainer Orth Committed by Rainer Orth

testsuite_hooks.h (__set_testsuite_memlimit): Retrieve current limits before setting.

	* testsuite/testsuite_hooks.h (__set_testsuite_memlimit):
	Retrieve current limits before setting.

From-SVN: r53490
parent 7bd9b6d4
2002-05-15 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* testsuite/testsuite_hooks.h (__set_testsuite_memlimit):
Retrieve current limits before setting.
2002-05-15 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/6518
......
......@@ -81,25 +81,33 @@ void
__set_testsuite_memlimit(float __size = MEMLIMIT_MB)
{
struct rlimit r;
r.rlim_cur = (rlim_t)(__size * 1048576);
rlim_t limit = (rlim_t)(__size * 1048576);
// Heap size, seems to be common.
#if _GLIBCPP_HAVE_MEMLIMIT_DATA
getrlimit(RLIMIT_DATA, &r);
r.rlim_cur = limit;
setrlimit(RLIMIT_DATA, &r);
#endif
// Resident set size.
#if _GLIBCPP_HAVE_MEMLIMIT_RSS
getrlimit(RLIMIT_RSS, &r);
r.rlim_cur = limit;
setrlimit(RLIMIT_RSS, &r);
#endif
// Mapped memory (brk + mmap).
#if _GLIBCPP_HAVE_MEMLIMIT_VMEM
getrlimit(RLIMIT_VMEM, &r);
r.rlim_cur = limit;
setrlimit(RLIMIT_VMEM, &r);
#endif
// Virtual memory.
#if _GLIBCPP_HAVE_MEMLIMIT_AS
getrlimit(RLIMIT_AS, &r);
r.rlim_cur = limit;
setrlimit(RLIMIT_AS, &r);
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment