I have a large dynamically allocated array (C ++, MSVC110), and I initialize it as follows:
try {
size_t arrayLength = 1 << 28;
data = new int[arrayLength];
for (size_t i = 0; i < arrayLength; ++i) {
data[i] = rand();
}
}
catch (std::bad_alloc&) { }
Everything was in order before I tried to allocate more than the real system RAM, for example 10 GB. I expected to get an exception bad_alloc, but the system (Win7) began to change like crazy, etc., you know what I'm talking about.
Then I examined the situation in my task manager and noticed an interesting thing, in debug mode the selection was instantaneous, but in the release it was gradual.
Debug Mode:

Release Mode:

What causes this? Could this adversely affect performance? Did I do something wrong? Is the OS causing this? Or C ++ allocator?
, , . , ++?
, ββWindows, .