Created
June 28, 2024 21:36
-
-
Save hawkinsw/32a285bfd2389948ff195bf64b37343a to your computer and use it in GitHub Desktop.
Does Windows "Over" Allocate?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <malloc.h> | |
#include <cassert> | |
int main() { | |
std::ofstream output{ "results-release.csv" }; | |
uint64_t max_alloc_request_size = 16*1024; | |
uint64_t alloc_request_size = 0; | |
for (; alloc_request_size < max_alloc_request_size; alloc_request_size++) { | |
void* leaked = malloc(alloc_request_size); | |
assert(leaked != NULL); | |
auto alloc_actual_size = _msize(leaked); | |
output << alloc_request_size << ", " << alloc_actual_size << "\n"; | |
free(leaked); | |
} | |
output.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment