From 5ad0d2feb9ce655fb39e414bd4e3696356780cdb Mon Sep 17 00:00:00 2001 From: Seng Leung Date: Tue, 7 Nov 2023 21:18:19 +0000 Subject: [PATCH] Add ClearEntryCache() to Modules (#260) This function clears the entryCache in Modules to free up memory after processing modules. entryCache is used by the ToEntry function to cache previously converted nodes. Fixes #259 --- pkg/yang/modules.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/yang/modules.go b/pkg/yang/modules.go index 1d47a4e..4afb91f 100644 --- a/pkg/yang/modules.go +++ b/pkg/yang/modules.go @@ -442,3 +442,9 @@ func (ms *Modules) include(m *Module) error { } return nil } + +// ClearEntryCache clears the entryCache containing previously converted nodes +// used by the ToEntry function. +func (ms *Modules) ClearEntryCache() { + ms.entryCache = map[Node]*Entry{} +}