Skip to content

Commit

Permalink
Fix memory leak caused by wrong memory management of CSignal static m…
Browse files Browse the repository at this point in the history
…ember variables.
  • Loading branch information
geektoni committed Jul 11, 2017
1 parent 8ac2b02 commit 6f1603a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/shogun/base/init.cpp
Expand Up @@ -35,6 +35,8 @@ shogun::CMap<void*, shogun::MemoryBlock>* sg_mallocs=NULL;
#include <google/protobuf/stubs/common.h>
#endif

#include <rxcpp/rx-lite.hpp>

namespace shogun
{
Parallel* sg_parallel=NULL;
Expand Down Expand Up @@ -122,6 +124,10 @@ namespace shogun
SG_UNREF(sg_parallel);
SG_UNREF(sg_io);

delete CSignal::m_subscriber;
delete CSignal::m_observable;
delete CSignal::m_subject;

#ifdef HAVE_PROTOBUF
::google::protobuf::ShutdownProtobufLibrary();
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/lib/Signal.h
Expand Up @@ -90,7 +90,7 @@ namespace shogun
private:
/** Active signal */
static bool m_active;

public:
/** Observable */
static SGSubjectS * m_subject;
static SGObservableS * m_observable;
Expand Down

0 comments on commit 6f1603a

Please sign in to comment.