diff --git a/classpath/java/lang/Runtime.java b/classpath/java/lang/Runtime.java index 6d1faf812d..e73d74b35b 100644 --- a/classpath/java/lang/Runtime.java +++ b/classpath/java/lang/Runtime.java @@ -129,6 +129,8 @@ public class Runtime { public native long freeMemory(); public native long totalMemory(); + + public native long maxMemory(); private static class MyProcess extends Process { private long pid; diff --git a/src/builtin.cpp b/src/builtin.cpp index 46b82f4748..4369ec62d2 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -371,6 +371,12 @@ extern "C" AVIAN_EXPORT int64_t JNICALL return t->m->heap->limit(); } +extern "C" AVIAN_EXPORT int64_t JNICALL + Avian_java_lang_Runtime_maxMemory(Thread* t, object, uintptr_t*) +{ + return t->m->heap->limit(); +} + extern "C" AVIAN_EXPORT int64_t JNICALL Avian_avian_avianvmresource_Handler_00024ResourceInputStream_getContentLength( Thread* t, diff --git a/test/Misc.java b/test/Misc.java index ab69d7490b..19195277aa 100644 --- a/test/Misc.java +++ b/test/Misc.java @@ -360,6 +360,7 @@ public class Misc { // just test that it's there; don't care what it returns: Runtime.getRuntime().totalMemory(); + Runtime.getRuntime().maxMemory(); } protected class Protected { }