Handmade Network»Forums
Frank Corrao
3 posts
Lead QA Technologist, SR. Software Test Engineer, QA Tool Developer, Hobby Game Developer
TranState exception after Episode 85
Hi all, I got started late and with limited time am currently about to start episode 86, I did a WinMerge comparison from Casey's code at the end of episode 85 to my code and all files are identical, I am using VS 2015 U3 as debugger, the code compiled using the build.bat file with no errors but when I run it I get an exception at:

transient_state *TranState = (transient_state *)Memory->TransientStorageSize;
breaks here---> if(!TranState->IsInitialized)

Exception is 'Exception thrown: read access violation. TranState was 0x40000000'

looking in the Debugger I cannot see where this is coming from.
Memory Values were:
TransientStorageSize: 1073741824
TransientStorage: 0x0000020010000000

Any help to understand why this occurred and how to get around it would be appreciated.

P.S. My system has 16GB of Memory, the only apps runnign were VLC running the episode video, Sublime_Text 3, and VS running the app.

Thanks,

LordRhys


Mārtiņš Možeiko
2559 posts / 2 projects
TranState exception after Episode 85
Edited by Mārtiņš Možeiko on
This line seems wrong:
1
transient_state *TranState = (transient_state *)Memory->TransientStorageSize;

It assigns size (a number) to a pointer.

Imho it should be this:
1
transient_state *TranState = (transient_state *)Memory->TransientStorage;

Frank Corrao
3 posts
Lead QA Technologist, SR. Software Test Engineer, QA Tool Developer, Hobby Game Developer
TranState exception after Episode 85
I thought that might be the problem, changed that but got same error a couple of lines further down in the GroundBuffer so also matched InitializeArena() to the same format as used in Permanent Storage.

InitializeArena(&TranState->TranArena, Memory->TransientStorageSize - sizeof(transient_state),
(uint8 *)Memory->TransientStorage + sizeof(transient_state));

This fixed the problem, what I don't understand is why Casey didn't get the issue and he is using TransientStorageSize for both entries. I checked his code zip for day 85 and 86, but I see when I get to Day 87 he will change it.

Thanks for help!