java - Heap memory vs object memory -
according paper java memory , characteristics:
"... the memory score partitions 2 types: heap memory, memory consumed application during runtime, , object memory, memory allocated various objects used in program, such integers , strings, etc. ..."
do mean stack memory when object memory, or mean? (confused since, if not wrong, objects allocated in heap in java)
second question, if want measure total size of heap , stack during full program execution, tool should use? have been looking around , tried out built-in java profiler in netbeans 7.3.1 , yourkit 12.0.6, able inspect heap when comes studying "objects" , variables placed on stack, can not find way!
to sum up, how measure paper describing:
- total heap memory used
- total object memory used
thanks!
heap memory : storage java objects. when use new keyword create instance of class.
stack memory : used store local variables, method call, etc. jvm can decide , use store objects performance.
to get, total memory used-
usedmemory = runtime.getruntime().totalmemory() - runtime.getruntime().freememory();
you cannot stack memory on runtime can start app predefined stack size depends on platform.
there's non-heap memory think defined object memory used store loaded classes..metadata, etc.
references:
Comments
Post a Comment