[apparmor] [PATCH 07/11] Do early cleanup of perm_map
John Johansen
john.johansen at canonical.com
Tue Oct 19 01:20:39 BST 2010
Cleanup the perm_map as soon as it is no longer needed. Cleaning up the map
before the end of the functions reduces the peak memory of the function
---
parser/libapparmor_re/regexp.y | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/parser/libapparmor_re/regexp.y b/parser/libapparmor_re/regexp.y
index 4c5d801..49d9f37 100644
--- a/parser/libapparmor_re/regexp.y
+++ b/parser/libapparmor_re/regexp.y
@@ -1746,6 +1746,11 @@ void DFA::minimize(dfaflags_t flags)
cerr << "\033[2KMinimize dfa: partitions " << partitions.size() << "\tinit " << partitions.size() << "\t(accept " << accept_count << ")\r";
}
+ /* perm_map is no longer needed so free the memory it is using.
+ * Don't remove - doing it manually here helps reduce peak memory usage.
+ */
+ perm_map.clear();
+
int init_count = partitions.size();
if (flags & DFA_DUMP_PROGRESS)
cerr << "\033[2KMinimize dfa: partitions " << partitions.size() << "\tinit " << init_count << "\t(accept " << accept_count << ")\r";
--
1.7.1
More information about the AppArmor
mailing list