Блог пользователя _MrBean_

Автор _MrBean_, 6 недель назад, По-английски

Hello everyone!

I faced with a strange problem in VS 2022. I was solving a problem and at some point, when I built the project, my PC started to crash and was not responding to anything. I opened the task manager (it took around 10 minutes) and noticed that the memory (RAM) was fully used (12GB of 12GB).

I thought that the reason could be the array's size, so I deleted everything from the code besides one array, and I found out that when I use an array pair<int, int> dp[505][505] in my code, then during building VS starts to use around 6GB of memory (sometimes up to 8GB). Even after end of the building (it took around 30 seconds), memory used by VS was fluctuating between 0.5 and 5 GB.

The simplified code
The memory graph

But when changing array into pair<int, int> dp[5005][505] it started to be built in around 3 seconds, and the memory used by VS was not higher than 1GB and PC operated normally without having any memory crashes.

I would be very thankfull if somebody could explain what's going on and how to fix this issue? ... (I just changed 505 into 5005)!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится