Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For my Android AndEngine game, I used the scene based approach. Game contains more graphics so I need to load and unload those graphics multiple time so that game runs smoothly.

But doing this, I found that there was continuous increase in heap memory. Following log trace represent that thing:

06-14 08:48:26.990: I/dalvikvm-heap(669): Grow heap (frag case) to 10.715MB for 2457616-byte allocation
06-14 08:48:40.619: I/dalvikvm-heap(669): Grow heap (frag case) to 11.110MB for 2457616-byte allocation

Is this normal behaviour?

share|improve this question

closed as too localized by Sean Middleditch, msell, Le Comte du Merde-fou, Byte56, Nicol Bolas Jun 14 '13 at 16:21

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

@sm4 Removing most of the log certainly made this question cleaner, but I think the question is still unanswerable. The allocation comes from the user-specific (too specific) code. – Seth Battin Sep 11 '13 at 21:10
up vote 1 down vote accepted

This is normal JVM heap behaviour. Java allocates memory automatically for each object and releases it when it decides it's a good time to release it. Unless you hit an OutOfMemory error, don't worry about small increases. Also note that textures live in a different memory, not the JVM Heap. So loading and unloading textures has little to do with growing of your heap.

There are many types of objects in Java and based on their purpose and "age" they get collected at certain times. This is not really a GameDev question and you can find more information at Oracle website or StackOverflow.

share|improve this answer
Thanks for your answer. I got the thing what I want from your answer. If I want to ask general gaming concept then where I have to ask? Because other people only knowing down voting. – Siddharth Jun 16 '13 at 12:57
You asked question that is too localized to your problem. It's not general gaming concept question neither. More like general Java question. I have edited your question to make it more general, but it still belongs to Stack Overflow, where it is probably already answered (many times). – sm4 Jun 17 '13 at 6:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.