Skip to content

Commit

Permalink
Add ClearEntryCache() to Modules (#260)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sengleung committed Nov 7, 2023
1 parent 3ae8e57 commit 5ad0d2f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/yang/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}

0 comments on commit 5ad0d2f

Please sign in to comment.