Author Topic: Converting hex to value when attempting to examine heap  (Read 2349 times)

0 Members and 1 Guest are viewing this topic.

Offline Cloudee1

Converting hex to value when attempting to examine heap
« on: October 02, 2014, 10:10:57 AM »
Assuming that Troflip's easy alt debugging is installed, pressing alt-m shows you two print statements, the first is the free heap chunk sizes and the other, a summary of memory values. To my understanding, the first print message displays the size of the available chunks of heap space in hexadecimal format.  So is the whole value the size, or is it the value preceding the @ symbol

For instance here is what I am currently looking at when I hit alt-m:

a@892a
dcc@8f08
31e@a92a
902@dfde

So converting that whole segment:
690474
231509768
52341034
151183326

or just the value preceding the @:
10
3532
798
2306

Which by the way, the next print statement tells me the Free Heap is 3530 Bytes, which I guess answers my question right there. The free heap statement, isn't telling me the total free heap but instead the largest chunk of free heap, which corresponds with just the values preceding the @ symbol in the first message as representing the hexadecimal value of the space available. I am assuming that the value that follows the @ symbol tells me where in the stack the free heap chunk lies, if I am saying that right. Anyone know how to get from the value to actually finding the issues?

So in conclusion what I am looking at is some fragmented heap memory since, their should really only be one large chunk at the end and some smaller ones up front. My largest is pretty much up front. Crap!

The next couple of rooms look slightly better since the largest chunk at least falls at the end, but there is still a big one up front.
Room2: 10   3704   798   5644
Room3: 10   3260   798   6020
Room4: "Out of heap space"

*Edit

Now the problem is definitely resulting from whatever is going on in my title screen changeState. When I comment it out and run the game, checking again.
Room1: 10 4 26 6606
Room2: 10 20 10124
Room3: 10 8 10020
Room4: 10 4 4472

I am unloading all of the views and the actual room script number, Not sure why it is getting stuck in the heap stack.
« Last Edit: October 02, 2014, 10:28:56 AM by Cloudee1 »


Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Collector

Re: Converting hex to value when attempting to examine heap
« Reply #1 on: October 02, 2014, 11:50:29 AM »
Gumby might have some idea, but you will have to wait for him to get back on his feet.
KQII Remake Pic

Offline Cloudee1

Re: Converting hex to value when attempting to examine heap
« Reply #2 on: October 02, 2014, 02:22:10 PM »
Ok, I have done some pretty crazy stuff in trying to get this bad boy figured out and it looks like I have accomplished my goal.

First off I broke the title screen into 3 different rooms. Directly after loading I go to the initrooms script which launches me into the intro by going to room 801 then on to 802 and then I go back to the initrooms script to launch me into the game. Accomplished this by setting up a previous room statement in the initrooms script looking for 800 to move on to 801 and any other previous room moves on to room 1. This is also how the restart menu option works, not with a switch but by simply calling the init rooms script. I figured I would make use of it and breaking up the titlescreen room so that I could track down the offending resource.

Anyway, with all the monkeying around and hammering away at the keyboard I have done, this is where I currently stand. Allowing the intro to play all the way through including all the current sounds and mp3's I have set up so far and landing at the start of the game, I get these values for my free heap chunks.

Room1: 10    6634
Room2: 10    13300
Room3: 10    13232
Room4: 10    7632
Room5: 10    13706
Room6: 10    15916

Heap has been successfully defragmented for now. It would still be nice to know how to use the value after the @ in order to target the issues, but my game is now back to playable.

« Last Edit: October 02, 2014, 02:47:23 PM by Cloudee1 »
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.026 seconds with 22 queries.