pcbnew - huge memory leak

Description

Memory leak of around 1-2MB per each leak.

I have a PCB project that is leaking memory. I was unable to reproduce it by creating a new test project, so I'm attaching my project. spar6.zip Tested on both win10 (hw) and win11 (vm).

Steps to reproduce

  1. open the attached project in pcbnew.
  2. Start the modification/creation of any track ('D' or 'X' shortcut).
  3. Cancel or complete the operation.
  4. Observe the leaked memory.

alternative steps (but probably the same leak source):

  1. open the project.
  2. Start the length measure tool ('7' shortcut)
  3. hover over any track
  4. hover over another track
  5. Observe the leaked memory.

KiCad Version

Application: KiCad PCB Editor x64 on x64

Version: 8.0.8, release build

Libraries:
	wxWidgets 3.2.6
	FreeType 2.13.3
	HarfBuzz 10.0.1
	FontConfig 2.15.0
	libcurl/8.10.1-DEV Schannel zlib/1.3.1

Platform: Windows 11 (build 22631), 64-bit edition, 64 bit, Little endian, wxMSW
OpenGL: VMware, Inc., Gallium 0.4 on SVGA3D; build: RELEASE;  LLVM;, 3.0 Mesa 11.2.0 (git-b9d3786)

Build Info:
	Date: Jan 11 2025 18:59:49
	wxWidgets: 3.2.6 (wchar_t,wx containers)
	Boost: 1.86.0
	OCC: 7.8.1
	Curl: 8.10.1-DEV
	ngspice: 44
	Compiler: Visual C++ 1942 without C++ ABI

Build settings: