Why does new allocate 1040 extra bytes the first time?
问题 I was creating this simple test program to demonstrate the way alignment works when allocating memory using standard new... #include <iostream> #include <iomanip> #include <cstdint> // // Print a reserved block: its asked size, its start address // and the size of the previous reserved block // void print(uint16_t num, uint16_t size_asked, uint8_t* p) { static uint8_t* last = nullptr; std::cout << "BLOCK " << num << ": "; std::cout << std::setfill('0') << std::setw(2) << size_asked << "b, ";