Simulation: Crash on win11 when not enough memory for ngspice to allocate

Description

A crash coming from ngspice 45.2 in win11, when there is not enough memory to allocate.

On Linux i am on an older ngspice version and i couldn't reproduce this, while also i had more available memory in that system.

Affects v10 and current master.

Steps to reproduce

  1. Open Class-D demo project, change simulation end time from 3m to 3s, run simulation
  2. It may crash on the first or the second run, while there shows a message in console window regarding mem allocating issue

KiCad Version

Application: KiCad x64 on x64

Version: 10.99.0-8-geec5b07179, release build

Libraries:
	wxWidgets 3.3.2 
	FreeType 2.13.3
	HarfBuzz 12.3.0
	FontConfig 2.17.1

Platform: Windows 11 (build 26200), 64-bit edition, 64 bit, Little endian, wxMSW
OpenGL: ATI Technologies Inc., AMD Radeon RX 6600, 4.6.0 Compatibility Profile Context 26.3.1.260303

	wxWidgets: 3.3.2 (wchar_t,STL containers)
	Boost: 1.90.0
	OCC: 7.9.2
	Curl: 8.18.0
	ngspice: 45.2
	Compiler: Visual C++ 1944 without C++ ABI
	KICAD_IPC_API=ON
	KICAD_USE_PCH=OFF

Locale: 
	Lang: el_GR
	Enc: UTF-8
	Num: 1.234,5
	Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)