[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Consolidating Memory Block Headers" vod_platform=youtube id=XBft9E6NBDU annotator=Miblo] [0:11][Recap and set the stage for the day] [1:07][Run the game and assess our current situation] [3:22][Blackboard: Memory Protection] [7:08][Consider sharing the memory protection block with the operating system] [10:10][handmade_platform.h: Introduce platform_memory_block struct which is shared with win32_memory_block] [12:08][handmade_platform.h: Collapse the memory_block_chain into platform_memory_block] [15:31][handmade_memory.h: Make PushSize_() use our new platform-provided struct] [22:29][handmade_memory.h: Make Clear() and FreeLastBlock() operate on this struct] [24:48][win32_handmade.cpp: Rewrite PLATFORM_ALLOCATE_MEMORY() and PLATFORM_DEALLOCATE_MEMORY() to implement our new shared scheme] [30:30][Run the game and fix miscellaneous bugs] [33:08][Run the game to see that we're running okay] [33:39][win32_handmade.cpp: Enable PLATFORM_ALLOCATE_MEMORY() to perform overflow checking] [39:57][Blackboard: Checking for any set bits] [41:35][win32_handmade.cpp: Continue enabling overflow checking] [43:39][Run the game to see it successfully catch our overflow bug] [44:18][handmade_world.cpp: Remove that bug, run it again, crash in PushAndNullTerminate() and investigate why] [46:23][Calculate what we would expect] [48:17][Step through PushSize_() to see what it's computing] [52:17][Consider our choices for getting the correct alignment] [53:57][handmade_memory.h: Enable PushSize_() to compute the size using the alignment] [54:37][Run the game to find that we are maintaining alignment] [55:45][handmade_memory.h: Prevent PushSize_() from enabling the bounds checking, run the game and try looped code editing] [56:19][Investigate what's happening with the SourceBlock.Size][quote 532] [58:12][win32_handmade.cpp: Make PLATFORM_ALLOCATE_MEMORY() set the PageSize directly to aid our investigations] [1:01:57][Q&A][:speech] [1:02:37][@insobot][Bashing Tim Berners-Lee, inventor of the outer loop from 0 to freee everything?] [1:02:57]["It's kind of like insobot is the beat poet of our generation"][quote 533] [1:03:51][@pragmascrypt][Maybe set the default alignment to 1 when in memory checking mode?] [1:04:18][todo.txt: Update the TODO list] [1:05:03][@danyguag][I know this is a little off-topic to what you are currently doing on stream, but what role does a software driver play if any at all?] [1:06:56][@danyguag][No, you can make a C++ project that enables you to use resources that you can't use in user mode in the kernel] [1:10:52][Done][:speech] [/video]