The memory limit for competitive programming is 1024M, and I would like to prevent further memory usage. Please let me know if there is a compiler option that can do this.
c++
Can't I use Visual Studio debugs to measure memory usage?
With C++, memory retention and release are aggregated into four functions:
void*operator new(size_t size);
void*operator new[](size_t size);
void operator delete (void*ptr);
void operator delete [] (void*ptr);
Once you have redefined them (you might want to call them internally malloc
/free
), you can see the increase or decrease in memory usage due to memory retention and release.Then you can manage your own memory limits within new
.
However, this method has not been involved in malloc
other memory reserves.
© 2024 OneMinuteCode. All rights reserved.