• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

confused in HEAP and freeMemory()

Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic