/* Getter for RLIMIT_AS.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
OpenBSD:
a) setrlimit exists, but RLIMIT_AS is not defined.
- b) No VMA iteration API exists.
+ b) mquery() can be used to find out about the virtual memory areas.
AIX:
a) setrlimit with RLIMIT_AS succeeds but does not really work: The OS
get_rusage_as_via_setrlimit() therefore produces a wrong value.
b) The /proc/$pid/maps file lists only the memory areas belonging to
the executable and shared libraries, not the anonymous memory.
- But the native Win32 API works.
+ But the native Windows API works.
mingw:
a) There is no setrlimit function.
- b) The native Win32 API works.
+ b) The native Windows API works.
BeOS, Haiku:
a) On BeOS, there is no setrlimit function.
return result;
}
+#else
+
+static inline uintptr_t
+get_rusage_as_via_setrlimit (void)
+{
+ return 0;
+}
+
#endif
return get_rusage_as_via_iterator ();
#endif
}
+
+
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main ()
+{
+ printf ("Initially: 0x%08lX 0x%08lX 0x%08lX\n",
+ get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (),
+ get_rusage_as ());
+ malloc (0x88);
+ printf ("After small malloc: 0x%08lX 0x%08lX 0x%08lX\n",
+ get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (),
+ get_rusage_as ());
+ malloc (0x8812);
+ printf ("After medium malloc: 0x%08lX 0x%08lX 0x%08lX\n",
+ get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (),
+ get_rusage_as ());
+ malloc (0x281237);
+ printf ("After large malloc: 0x%08lX 0x%08lX 0x%08lX\n",
+ get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (),
+ get_rusage_as ());
+ return 0;
+}
+
+#endif /* TEST */