Usb port randomly disconnecting from PC after some time

I am using an Arduino MKR Vidor 4000 and everything has been working like a charm, but some time ago it started to randomly disconnect the usb port. It is communicating over Serial with the PC and this communication is essential. However, sometimes when starting the program it crashes after a few seconds and the PC plays the disconnecting sound, this mostly happens at the first run after uploading and only seldomly when powering it up without uploading.

The weird thing is that it is totally different to when the cpu crashes!
I am now intentionally crashing the cpu with this code:

for(int i = 0; i < 10000; i++) {
    uint32_t* ptr = new uint32_t[1];
}

However, when this crash is provoked, it is different from what i am experiencing: In this case the code stalls (blinking LED stops) and the serial monitor is not responding and when pressing reset, everything is back to normal and the program starts again.

Im my case however, the code also stalls (blinking led stops), but the serial monitor keeps responding, the PC plays the disconnecting sound and when pressing reset nothing happens. The only way to restart is to disconnect and reconnect to the PC.

Question: What causes the USB to disconnect on the MKR Vidor 4000, in other words, what component is responsible for the USB connection? Is it the CPU, the FPGA or an external chip?

I am also using a custom bitstream made in Intel Quartus on the FPGA, but it is generally working and if the FPGA crashes, why would the CPU then also stop working? The CPU doesn't have any point where it would wait for the FPGA to respond.

Any ideas?

in other words, what component is responsible for the USB connection? Is it the CPU

Yes.

Could a memory issue like fragmentation or a stack overflow be the cause for the CPU to stop and not be resettable until power is removed?

PS: I realized i am using 'Strings' everywhere and i am currently trying to remove all of them...