Skip to content

Huge memory leak in the Linux kernel (400-500 MB, likely in the video driver) triggered on every opening KiCad with a moderately complex schematic. #6817

@zxmak

Description

@zxmak

Describe the bug

Every time I open a moderately complex schematic file in KiCad, and then immediately close KiCad without doing anything, the amount of free memory decreases by approximately 400 - 500 MB.

Each new launch of KiCad causes an additional 400 - 500 MB of memory loss. After 8 - 10 launches, the system runs out of memory and becomes unresponsive. After KiCad closes, the system shows reduced available memory, but no running processes account for the missing memory.

The leak appears to occur at the kernel level, most likely within the video driver.
I am attaching a test schematic file (test.kicad_sch) that reproduces the issue reliably.

test.kicad_sch.zip

Please investigate and fix this issue.

Steps to reproduce the behaviour

  1. Install a clean Raspberry Pi OS Bookworm 64-bit with the Wayland Labwc compositor.

  2. Add the Debian backports repository by running:

sudo nano /etc/apt/sources.list.d/bookworm-backports.list

and adding the following line:

deb http://deb.debian.org/debian bookworm-backports main contrib non-free
  1. Install KiCad by running:
sudo apt update && sudo apt install -t bookworm-backports kicad
  1. Open test.kicad_sch with the KiCad schematic editor

  2. Close the KiCad schematic editor.

  3. Observe that approximately 400–500 MB of memory is leaked.

  4. Repeat steps 4 and 5 until the system freezes due to running out of memory.

Device (s)

Raspberry Pi 4 Mod. B

System

$ cat /etc/rpi-issue
Raspberry Pi reference 2023-09-22
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 40f37458ae7cadea1aec913ae10b5e7008ebce0a, stage4

$ vcgencmd version
Mar 19 2025 18:24:21 
Copyright (c) 2012 Broadcom
version ca6e8171a80ea46924ffaa629250bfb482f3a02c (clean) (release) (start)

$ uname -a
Linux rpi4 6.12.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) aarch64 GNU/Linux

KiCad:

Application: KiCad Schematic Editor aarch64 on aarch64

Version: 9.0.1+1, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.1
	libcurl/7.88.1 OpenSSL/3.0.15 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3 OpenLDAP/2.5.13

Platform: Debian GNU/Linux 12 (bookworm), 64 bit, Little endian, wxGTK, X11, LXDE-pi-labwc, wayland
OpenGL: Broadcom, V3D 4.2.14.0, 3.1 Mesa 24.2.8-1~bpo12+rpt2

Build Info:
	Date: Apr 10 2025 15:47:08
	wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.74.0
	OCC: 7.6.3
	Curl: 7.88.1
	ngspice: 39
	Compiler: GCC 12.2.0 with C++ ABI 1017
	KICAD_IPC_API=ON

Locale: 
	Lang: en_GB
	Enc: UTF-8
	Num: 1,234.5
	Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)

Logs

There are no error messages in the system log (dmesg) - no new entries appear during the launch/close of KiCad.

Similarly, there is no error output in the console when running eeschema test.kicad_sch from the terminal.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions