This PR consists of a number of fixes for resource leaks that became apparant after a sufficient number of re-configurations as exercised in #1221.
There are two classes of bugs here. The first, leaking ctypes (as well as memory used for non-GCed backing code from code-gen) was caused by callers failing to memoize the results of calling our various special purpose code generators. Or more specifically, failing to memoize the results of ffi.typeof(...) expressions that allocate new ctype IDs.
This PR fixes these by implementing the memoization at the roots of the problems, as opposed to relying on callers to account for resource management (prone to error).
The second class is lib.yang auxiliary functions creating temporary files in /var/run but failing to eventually unlink those. This eventually results in write errors to the typically ramfs backed storage which eventually fills up (“no space left on device”).
This PR consists of a number of fixes for resource leaks that became apparant after a sufficient number of re-configurations as exercised in #1221.
There are two classes of bugs here. The first, leaking ctypes (as well as memory used for non-GCed backing code from code-gen) was caused by callers failing to memoize the results of calling our various special purpose code generators. Or more specifically, failing to memoize the results of
ffi.typeof(...)
expressions that allocate new ctype IDs.This PR fixes these by implementing the memoization at the roots of the problems, as opposed to relying on callers to account for resource management (prone to error).
The second class is lib.yang auxiliary functions creating temporary files in
/var/run
but failing to eventually unlink those. This eventually results in write errors to the typically ramfs backed storage which eventually fills up (“no space left on device”).Fixes #1221