Assembly 43a: Dynamic Memory on x86_64 Linux and Windows
(Chapter links below)
Ever do an malloc in C or a new in C++? This video shows you how these are implemented in Assembly language. You’ll also learn a little about memory models and heap managers, and we’ll be coding and a lot of debugging to show you the results. So, strap in!
Assembly 42a (Previous): Programing the FPU’s XMM Registers:
Assembly 44a (Next): Creating, editing and Deleting files in Assembly: Coming Soon
00:00 Overview
01:43 C and C++ Examples
07:35 The Linux Memory Model
11:22 Dynamically allocating memory in Linux
34:22 Dynamically allocating memory in Windows
Windows Assembly prototypes for Heap Management (Needed to code the example(s) presented in the video):
GetProcessHeap PROTO
HeapAlloc PROTO, hHeap:DWORD, dwFlags:DWORD, dwBytes:DWORD
HeapCreate PROTO, flOptions:DWORD, dwInitialSize:DWORD, dwMaximumSize:DWORD
HeapDestroy PROTO, hHeap:DWORD
HeapFree PROTO, hHeap:DWORD, dwFlags:DWORD, lpMem:DWORD
HeapSize PROTO, hHeap:DWORD, dwFlags:DWORD, pMem:DWORD
[ad_2]
source