Okay, so I made a dungeon generator, and it works perfect. The only downside, is that it consumes all of my memory after generating new dungeons.
I've deducted that it may be in the list, rooms, because the generator generates Room objects, and stores it in the array list. Then, the tilemap is made by adding all of the widths and heights of the rooms IN that list. Thing is, I can't clear the list until I'm done with the dungeon, because references are made to each individual room for effects in the game.
Anyway, I get the heap space error after generating about 4 dungeons, and watching task manager, I can see Garbage Collector doesn't seem to be getting rid of the memory used by the last dungeon, and just accumulates the used memory until the game breaks.
I've taken all of the precautions to try and make sure the game doesn't run out of memory, but alas it hasn't worked.
This includes reinitializing all of the variables, clearing the room list, and mapTiles array before generating the new map.
What should I do?