diff options
author | Thomas Habets <thomas@habets.se> | 2020-04-10 17:40:11 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-11 01:41:39 +0200 |
commit | b5e8a552c09a1b9a1397e731cc6f54d427df9a67 (patch) | |
tree | dc60d92c7f53d5d15cbf42d2c5a2623a557eb7ca /gnuradio-runtime/lib/block_executor.cc | |
parent | 616879745ce5d61e6acd54ad84d60359a739a27d (diff) |
runtime: Remove most manual memory management
The remaining ones:
* `pmt_pool.cc`, which is a memory allocator so that makes sense
* the tricky and aptly named `sptr_magic.cc`.
Diffstat (limited to 'gnuradio-runtime/lib/block_executor.cc')
-rw-r--r-- | gnuradio-runtime/lib/block_executor.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc index 9d6d33bb9b..d4c98e1225 100644 --- a/gnuradio-runtime/lib/block_executor.cc +++ b/gnuradio-runtime/lib/block_executor.cc @@ -20,6 +20,7 @@ #include <block_executor.h> #include <stdio.h> #include <boost/format.hpp> +#include <boost/make_unique.hpp> #include <boost/thread.hpp> #include <iostream> #include <limits> @@ -213,11 +214,11 @@ static bool propagate_tags(block::tag_propagation_policy_t policy, } block_executor::block_executor(block_sptr block, int max_noutput_items) - : d_block(block), d_log(0), d_max_noutput_items(max_noutput_items) + : d_block(block), d_max_noutput_items(max_noutput_items) { if (ENABLE_LOGGING) { std::string name = str(boost::format("sst-%03d.log") % which_scheduler++); - d_log = new std::ofstream(name.c_str()); + d_log = boost::make_unique<std::ofstream>(name.c_str()); std::unitbuf(*d_log); // make it unbuffered... *d_log << "block_executor: " << d_block << std::endl; } @@ -232,9 +233,6 @@ block_executor::block_executor(block_sptr block, int max_noutput_items) block_executor::~block_executor() { - if (ENABLE_LOGGING) - delete d_log; - d_block->stop(); // stop any drivers, etc. } |