Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

confused in HEAP and freeMemory()  RSS feed

Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

Please look at this scenario. I have app with almost 10 classes into it.

I am creating one instance of class A inside startApp() of Midlet.

I am taking trace of FreeMemory() when ever I create a instance of any new class.

FreeMemory() gives me 10k to 12 k less every time if I create a new Instance of new class.

As I know MIDP loads class as and when needed. And freeMemory() give us Heap Size.
Heap size is basically for runtime allocation and global variables of Class. I have few classes with single big method and no other member variables. Even if I load such kind of classes first time it took 10k to 12k (Depending on the method length). I am not able to understand why these classes need so much of Heap.

Please help.
Waiting for reply.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!