Debugging with large buffer using stm32cube framework fails to start

I’m using a nucleo H743 board with pio and ststm32 and the stm32cube framework in VS code. I program the board using the on-board stlink and the pio-provided openocd.
I have a large global uint8_t array in the SRAM D2 domain, while the rest of my data are in D-TCM. I modify slightly the default cubeMX-generated linker script to be able to declare the array to be placed in D2 SRAM.
When I upload the firmware, I have no problems.
But when I use the debugger (gdb) openocd fails. The last few lines of debug console are

Loading section .dma_buffer, size 0x3fee lma 0x30000000
.pioinit:15: Error in sourced command file:
Load failed

I played around with the buffer size, and the problem appears when I exceed 16365 bytes.

It may be a recently introduced problem, because I recall debugging with large buffers, but I can’t be sure they were that large.

Has anybody else encountered such a problem? Are there any suggestions?