From aa30ccd31a0163bed25b993ae386efe1cd1feb39 Mon Sep 17 00:00:00 2001 From: fche Date: Sun, 25 Feb 2007 23:03:49 +0000 Subject: [PATCH] 2007-02-25 Frank Ch. Eigler * elaborate.h (match_node, derived_probe_builder): Add build_no_more member function. * elaborate.cxx (semantic_pass_symbols): Call it. * tapsets.cxx (dwarf_builder): Implement it by releasing dwflpp instance after pass 2, freeing mucho memory. --- ChangeLog | 8 ++++++++ elaborate.cxx | 15 ++++++++++++++- elaborate.h | 4 +++- tapsets.cxx | 17 +++++++++++++++-- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a3326955..b1c971b3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-25 Frank Ch. Eigler + + * elaborate.h (match_node, derived_probe_builder): Add + build_no_more member function. + * elaborate.cxx (semantic_pass_symbols): Call it. + * tapsets.cxx (dwarf_builder): Implement it by releasing dwflpp + instance after pass 2, freeing mucho memory. + 2007-02-23 Josh Stone PR 4096 diff --git a/elaborate.cxx b/elaborate.cxx index 05c2be57a..ef019016a 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1,5 +1,5 @@ // elaboration functions -// Copyright (C) 2005, 2006 Red Hat Inc. +// Copyright (C) 2005-2007 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -326,6 +326,15 @@ match_node::find_and_build (systemtap_session& s, } +void +match_node::build_no_more (systemtap_session& s) +{ + for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++) + i->second->build_no_more (s); + if (end) end->build_no_more (s); +} + + // ------------------------------------------------------------------------ // Alias probes // ------------------------------------------------------------------------ @@ -914,6 +923,10 @@ semantic_pass_symbols (systemtap_session& s) } } } + + // Inform all derived_probe builders that we're done with + // all resolution, so it's time to release caches. + s.pattern_root->build_no_more (s); return s.num_errors(); // all those print_error calls } diff --git a/elaborate.h b/elaborate.h index aafe0ae1f..8c3a68697 100644 --- a/elaborate.h +++ b/elaborate.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006 Red Hat Inc. +// Copyright (C) 2005-2007 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -170,6 +170,7 @@ struct derived_probe_builder std::map const & parameters, std::vector & finished_results) = 0; virtual ~derived_probe_builder() {} + virtual void build_no_more (systemtap_session &) {} static bool get_param (std::map const & parameters, const std::string& key, std::string& value); @@ -210,6 +211,7 @@ match_node void find_and_build (systemtap_session& s, probe* p, probe_point *loc, unsigned pos, std::vector& results); + void build_no_more (systemtap_session &s); match_node* bind(match_key const & k); match_node* bind(std::string const & k); diff --git a/tapsets.cxx b/tapsets.cxx index eaa719d42..55e64942d 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1,6 +1,6 @@ // tapset resolution -// Copyright (C) 2005, 2006 Red Hat Inc. -// Copyright (C) 2005, 2006 Intel Corporation. +// Copyright (C) 2005-2007 Red Hat Inc. +// Copyright (C) 2005-2007 Intel Corporation. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -1990,6 +1990,18 @@ struct dwarf_builder: public derived_probe_builder dwarf_builder() : kern_dw(NULL), user_dw(NULL) {} + + void build_no_more (systemtap_session &s) + { + if (kern_dw) + { + if (s.verbose > 3) + clog << "dwarf_builder releasing dwflpp" << endl; + delete kern_dw; + kern_dw = 0; + } + } + ~dwarf_builder() { if (kern_dw) @@ -1997,6 +2009,7 @@ struct dwarf_builder: public derived_probe_builder if (user_dw) delete user_dw; } + virtual void build(systemtap_session & sess, probe * base, probe_point * location, -- 2.43.5