What's going on??
Hello codeforces! Recently, i've noticed that codeforces custom test with g++ 17 uses more than 500bytes
per empty std::queue, while sizeof
shows only 40bytes
. This problem is also with std::deque. What's going on? Compiled with GNU G++17 7.3.0
Auto comment: topic has been updated by lis05 (previous revision, new revision, compare).
Nevermind, I misunderstood that you were comparing the computed value with the memory reported under the =====.
sizeof(arr)/1000
shows size in kb, look at the second imagesizeof(arr)/NMAX
shows size in bytes for single queuestd::queue
usesstd::deque
under the hood by default. And in GCC's libstdc++ standard library the latter allocates elements dynamically in chunks of ~512 bytes by default, seeM_initialize_map
here, plus one chunk extra. It's that extra chunk which makesstd::deque
weigh slightly more than 500 bytes.Thanks!