mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
Implement Runtime#{free,total}Memory()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
b246804793
commit
18aeeae0e8
@ -59,6 +59,7 @@ class Heap: public Allocator {
|
||||
|
||||
virtual void setClient(Client* client) = 0;
|
||||
virtual void setImmortalHeap(uintptr_t* start, unsigned sizeInWords) = 0;
|
||||
virtual unsigned remaining() = 0;
|
||||
virtual unsigned limit() = 0;
|
||||
virtual bool limitExceeded(int pendingAllocation = 0) = 0;
|
||||
virtual void collect(CollectionType type, unsigned footprint,
|
||||
|
@ -593,18 +593,16 @@ Avian_java_lang_Runtime_gc
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
Avian_java_lang_Runtime_freeMemory
|
||||
(Thread*, object, uintptr_t*)
|
||||
(Thread* t, object, uintptr_t*)
|
||||
{
|
||||
// todo
|
||||
return 0;
|
||||
return t->m->heap->remaining();
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
Avian_java_lang_Runtime_totalMemory
|
||||
(Thread*, object, uintptr_t*)
|
||||
(Thread* t, object, uintptr_t*)
|
||||
{
|
||||
// todo
|
||||
return 0;
|
||||
return t->m->heap->limit();
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT void JNICALL
|
||||
|
@ -1888,6 +1888,10 @@ class MyHeap: public Heap {
|
||||
c.immortalHeapEnd = start + sizeInWords;
|
||||
}
|
||||
|
||||
virtual unsigned remaining() {
|
||||
return c.limit - c.count;
|
||||
}
|
||||
|
||||
virtual unsigned limit() {
|
||||
return c.limit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user