Added basic support for the Runtime.maxFree() method. Some applications (BouncyCastle

for example) expect to be able to call this method.
This commit is contained in:
Jasper Siepkes 2016-12-16 10:44:11 +01:00
parent c545e3dde2
commit c918f2c2e0
3 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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 { }