diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-03-09 00:18:58 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-03-19 07:28:18 +0200 |
| commit | c04d4846f2a7a49e592f4e98f3e604851d600d4e (patch) | |
| tree | f3ec43f7507bac6981f0278cd027cc71fc85f165 /src/libsyntax/ext | |
| parent | 87e72c38122cbd24199365232217ca8c15ebe995 (diff) | |
| download | rust-c04d4846f2a7a49e592f4e98f3e604851d600d4e.tar.gz rust-c04d4846f2a7a49e592f4e98f3e604851d600d4e.zip | |
Discard MTWT & interner tables from TLD after they stop being useful.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/mtwt.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs index 909f3eaf361..1a5587433ac 100644 --- a/src/libsyntax/ext/mtwt.rs +++ b/src/libsyntax/ext/mtwt.rs @@ -126,6 +126,15 @@ pub fn display_sctable(table: &SCTable) { } } +/// Clear the tables from TLD to reclaim memory. +pub fn clear_tables() { + with_sctable(|table| { + *table.table.borrow_mut().get() = Vec::new(); + *table.mark_memo.borrow_mut().get() = HashMap::new(); + *table.rename_memo.borrow_mut().get() = HashMap::new(); + }); + with_resolve_table_mut(|table| *table = HashMap::new()); +} // Add a value to the end of a vec, return its index fn idx_push<T>(vec: &mut Vec<T> , val: T) -> u32 { |
