Error when compiling code with debugging mode using vscode debugger

I have been working with Platformio on VScode on a windows system as development IDE for Arduino and nRF52 systems. I am able to compile and upload my project code to the target device with no issues, but when I run debugging, compilation build is failing and this error is thrown
“cc1plus.exe: out of memory allocating 552720 bytes
*** [.pio\build\adafruit_feather_nrf52832\lib238\matrices\matrices.cpp.o] Error 1”
Does anyone have an idea of what is going on and a fix? I am using a JTAG debugger
Thanks - Aashyk

Sounds like a bug in the toolchain, as e.g. per here and here.

What exact platformio.ini are you using?