Received: from list by lists.gnu.org with archive (Exim 4.71) id 1dmmA4-0007MR-V5 for mharc-grub-devel@gnu.org; Tue, 29 Aug 2017 15:26:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmmA2-0007Ld-47 for grub-devel@gnu.org; Tue, 29 Aug 2017 15:26:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmm9z-0000Tz-0M for grub-devel@gnu.org; Tue, 29 Aug 2017 15:26:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:51105 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dmm9y-0000T2-QM for grub-devel@gnu.org; Tue, 29 Aug 2017 15:26:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5674AAE8E; Tue, 29 Aug 2017 19:26:49 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Cc: elliott@hpe.com, mchang@suse.com, Daniel Kiper , phcoder@gmail.com, Leif Lindholm Subject: [PATCH v5 0/2] efi: Free memory on exit Date: Tue, 29 Aug 2017 21:26:46 +0200 Message-Id: <20170829192648.55830-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Aug 2017 19:26:55 -0000 When exiting grub, we currently leave the heap allocated. This means that if we exit and rerun grub, after a few iterations we can run into memory shortage. This patch set frees the heap on exit. That way we can rerun grub many times without much problem. v3 -> v4: - Move grub_reboot to kern/efi/efi.c - use dynamic list instead of static array at runtime - use allocate_pool for list, so we are not bound by heap or random numbers - remember all allocations, not just the heap v4 -> v5: - free dynamic list entries on allocation removal Alexander Graf (2): efi: Move grub_reboot() into kernel efi: Free malloc regions on exit grub-core/Makefile.core.def | 4 --- grub-core/kern/efi/efi.c | 9 +++++ grub-core/kern/efi/init.c | 1 + grub-core/kern/efi/mm.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ grub-core/lib/efi/reboot.c | 33 ----------------- include/grub/efi/efi.h | 1 + include/grub/misc.h | 3 +- 7 files changed, 101 insertions(+), 38 deletions(-) delete mode 100644 grub-core/lib/efi/reboot.c -- 2.12.3