Skip to content

Commit

Permalink
Deallocate finalizer handler when shutting down
Browse files Browse the repository at this point in the history
We weren't deallocating the finalizer handler. We also don't need
to clean up the process_list_ and live_list_ because they are part of
the list lists too and will be cleaned up there.
  • Loading branch information
dbussink committed Jan 18, 2013
1 parent edddd44 commit 9d26199
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion vm/environment.cpp
Expand Up @@ -85,6 +85,7 @@ namespace rubinius {
, signature_(0)
, version_(0)
, signal_handler_(NULL)
, finalizer_handler_(NULL)
{
#ifdef ENABLE_LLVM
if(!llvm::llvm_start_multithreaded()) {
Expand Down Expand Up @@ -136,6 +137,7 @@ namespace rubinius {

Environment::~Environment() {
delete signal_handler_;
delete finalizer_handler_;

VM::discard(state, root_vm);
SharedState::discard(shared);
Expand Down Expand Up @@ -352,7 +354,7 @@ namespace rubinius {
}

void Environment::start_finalizer() {
new FinalizerHandler(state);
finalizer_handler_ = new FinalizerHandler(state);
}

void Environment::load_vm_options(int argc, char**argv) {
Expand Down
2 changes: 2 additions & 0 deletions vm/environment.hpp
Expand Up @@ -13,6 +13,7 @@ namespace rubinius {
class ConfigParser;
class QueryAgent;
class SignalHandler;
class FinalizerHandler;

/**
* Thrown when unable to find Rubinius runtime directories.
Expand Down Expand Up @@ -57,6 +58,7 @@ namespace rubinius {
int version_;

SignalHandler* signal_handler_;
FinalizerHandler* finalizer_handler_;

std::string system_prefix_;

Expand Down
2 changes: 0 additions & 2 deletions vm/gc/finalize.cpp
Expand Up @@ -92,8 +92,6 @@ namespace rubinius {
shared_.auxiliary_threads()->unregister_thread(this);

if(iterator_) delete iterator_;
if(process_list_) delete process_list_;
if(live_list_) delete live_list_;

for(FinalizeObjectsList::iterator i = lists_->begin(); i != lists_->end(); ++i) {
delete *i;
Expand Down

0 comments on commit 9d26199

Please sign in to comment.