Skip to content

Memory Leak Loading PCB file

Description

We have a board that was imported into KiCAD v5.0 using altium2kicad tool. This was then converted to KiCAD v6.0, and now trying to open using KiCAD v7.0...

Once we hit KiCAD v7.0, this kicad_pcb file is no longer able to be opened.

KiCAD pcbnew returns error window showing:

08:51:32: Overflow converting value 2592216027.191822 to i.
08:51:32: Overflow converting value -2592216027.191822 to i.
08:54:06: Memory exhausted loading PCB '/home/juansta/overflow.kicad_pcb' 

This is reflected in system monitoring tools by a ramping of RAM while trying to load the PCB:

image

Steps to reproduce

  1. Open overflow.kicad_pcb using pcbnew

  2. Watch RAM usage spike and eventually overflow

  3. This takes about a minute or so. During this time, pcbnew just shows "Loading PCB"...

    image

On closer inspection of the kicad_pcb file, I have found that the issue is related to zone items appearing in the kicad_pcb file, with no defined net_name.

(zone (net 0) (net_name "") (layer "F.Cu") (tstamp ...) (hatch edge 0.508)
    (connect_pads thru_hole_only (clearance 0.09144))
    (min_thickness 0.254) (filled_areas_thickness no)
    (fill yes (thermal_gap 0.508) (thermal_bridge_width 0.508))
    (polygon
      (pts
        (xy ...)
        ...
        (xy ...)
      )
    )
  )

This is probably an issue with the way the board was imported, but KiCAD v5.0 and v6.0 had no issues opening this file.

The attached sample file consists of a single zone element, with blank net_name

KiCad Version

Application: KiCad PCB Editor x86_64 on x86_64

Version: 7.0.0, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.0
	libcurl/7.87.0 OpenSSL/1.1.1t zlib/1.2.13 c-ares/1.18.1 nghttp2/1.51.0

Platform: Gentoo Linux, 64 bit, Little endian, wxGTK, KDE, x11

Build Info:
	Date: Feb 21 2023 13:36:55
	wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.81.0
	OCC: 7.7.0
	Curl: 7.87.0
	ngspice: 36
	Compiler: GCC 11.3.1 with C++ ABI 1016

Build settings:
	KICAD_USE_EGL=ON
	KICAD_SPICE=ON