Konsole and Yakuake are killed when a CLI program runs out of memory

I am encountering a problem where I launch a CLI program under Konsole (Yakuake behaves the same). If the process runs out of memory (OOM), then Konsole (Yakuake) is killed, so I cannot really tell at which step the OOM occurred.

If I run this in GNOME Terminal the terminal application survives and I get:

[1]    16561 killed     poetry run python my_program.py

Why is there a difference in the system behaviour between GNOME Terminal and Konsole/Yakuake? Is this something that can be adjusted?

According to the dev(s), this behaviour is hard to control from the Konsole perspective: