Created
March 12, 2023 21:02
-
-
Save ReidAtcheson/5c36a510376b918380823ffba18a0e1b to your computer and use it in GitHub Desktop.
why alloc
This file contains 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 <memory_resource> | |
int main(int argc,char** argv){ | |
void* buffer; | |
std::pmr::monotonic_buffer_resource resource(buffer,8,std::pmr::null_memory_resource()); | |
// When Above commented out: | |
// | |
//valgrind ./a.out | |
//==68433== HEAP SUMMARY: | |
//==68433== in use at exit: 0 bytes in 0 blocks | |
//==68433== total heap usage: 0 allocs, 0 frees, 0 bytes allocated | |
// | |
// | |
// When *not* commented out: | |
//==68511== HEAP SUMMARY: | |
//==68511== in use at exit: 0 bytes in 0 blocks | |
//==68511== total heap usage: 1 allocs, 1 frees, 72,704 bytes allocated | |
// | |
// | |
//Built with: g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment