aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-25 10:54:09 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-01-25 10:54:09 +0000
commit160bde89e7fd9543beb30c0b55b2daf82843721b (patch)
treefd822f7a7aae59381624a95f77cab0cd60bf78a1
parent8cb83fa3d60d73cfb37afc79ab3c7cdd95b2429d (diff)
downloadpaludis-160bde89e7fd9543beb30c0b55b2daf82843721b.tar.gz
paludis-160bde89e7fd9543beb30c0b55b2daf82843721b.tar.xz
Free up some rams when they're not needed
-rw-r--r--src/clients/cave/cmd_display_resolution.cc25
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc18
2 files changed, 25 insertions, 18 deletions
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 7d7476e..a8c5dc3 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -893,17 +893,20 @@ DisplayResolutionCommand::run(
cmdline.import_options.apply(env);
- int fd(destringify<int>(getenv_with_default("PALUDIS_SERIALISED_RESOLUTION_FD", "")));
- SafeIFStream deser_stream(fd);
- const std::string deser_str((std::istreambuf_iterator<char>(deser_stream)), std::istreambuf_iterator<char>());
- Deserialiser deserialiser(env.get(), deser_str);
- Deserialisation deserialisation("ResolverLists", deserialiser);
- ResolverLists lists(ResolverLists::deserialise(deserialisation));
-
- display_jobs(env, lists, cmdline);
- display_untaken(env, lists, cmdline);
- display_errors(env, lists, cmdline);
- display_explanations(env, lists, cmdline);
+ std::tr1::shared_ptr<ResolverLists> lists;
+ {
+ int fd(destringify<int>(getenv_with_default("PALUDIS_SERIALISED_RESOLUTION_FD", "")));
+ SafeIFStream deser_stream(fd);
+ const std::string deser_str((std::istreambuf_iterator<char>(deser_stream)), std::istreambuf_iterator<char>());
+ Deserialiser deserialiser(env.get(), deser_str);
+ Deserialisation deserialisation("ResolverLists", deserialiser);
+ lists = make_shared_copy(ResolverLists::deserialise(deserialisation));
+ }
+
+ display_jobs(env, *lists, cmdline);
+ display_untaken(env, *lists, cmdline);
+ display_errors(env, *lists, cmdline);
+ display_explanations(env, *lists, cmdline);
return 0;
}
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index 06a8b64..71f0645 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -35,6 +35,7 @@
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/simple_visitor-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/type_list.hh>
#include <paludis/resolver/resolutions.hh>
@@ -871,14 +872,17 @@ ExecuteResolutionCommand::run(
cmdline.import_options.apply(env);
- int fd(destringify<int>(getenv_with_default("PALUDIS_SERIALISED_RESOLUTION_FD", "")));
- SafeIFStream deser_stream(fd);
- const std::string deser_str((std::istreambuf_iterator<char>(deser_stream)), std::istreambuf_iterator<char>());
- Deserialiser deserialiser(env.get(), deser_str);
- Deserialisation deserialisation("ResolverLists", deserialiser);
- ResolverLists lists(ResolverLists::deserialise(deserialisation));
+ std::tr1::shared_ptr<ResolverLists> lists;
+ {
+ int fd(destringify<int>(getenv_with_default("PALUDIS_SERIALISED_RESOLUTION_FD", "")));
+ SafeIFStream deser_stream(fd);
+ const std::string deser_str((std::istreambuf_iterator<char>(deser_stream)), std::istreambuf_iterator<char>());
+ Deserialiser deserialiser(env.get(), deser_str);
+ Deserialisation deserialisation("ResolverLists", deserialiser);
+ lists = make_shared_copy(ResolverLists::deserialise(deserialisation));
+ }
- return execute_resolution(env, lists, cmdline);
+ return execute_resolution(env, *lists, cmdline);
}
std::tr1::shared_ptr<args::ArgsHandler>