command to see memory allocation status

This commit is contained in:
minjaesong
2022-05-06 17:38:20 +09:00
parent 9df0f9ddba
commit c05b973505
2 changed files with 6 additions and 0 deletions

2
assets/disk0/malloc.js Normal file
View File

@@ -0,0 +1,2 @@
let [blockSize, blockCount] = sys.getMallocStatus()
println(`${blockSize * blockCount} bytes allocated (${blockCount} blocks with ${blockSize} bytes per block)`)

View File

@@ -169,6 +169,10 @@ class VMJSR223Delegate(val vm: VM) {
fun unsetSysrq() {
vm.sysrqDown = false
}
fun getMallocStatus(): IntArray {
return intArrayOf(vm.MALLOC_UNIT, vm.allocatedBlockCount)
}
}
class VMSerialDebugger(val vm: VM) {