Skip to content

Commit

Permalink
Merge pull request #504 from gsomix/CSet
Browse files Browse the repository at this point in the history
СMap for mallocs tracing
  • Loading branch information
Soeren Sonnenburg committed May 7, 2012
2 parents 8105d5f + 0e70022 commit f04183b
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 143 deletions.
1 change: 0 additions & 1 deletion examples/undocumented/libshogun/Makefile
Expand Up @@ -59,7 +59,6 @@ TARGETS = basic_minimal \
splitting_standard_crossvalidation \
mathematics_arpack \
library_fibonacci_heap \
library_hashset \
mathematics_lapack \
converter_locallylinearembedding \
converter_localtangentspacealignment \
Expand Down
24 changes: 0 additions & 24 deletions examples/undocumented/libshogun/library_hashset.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions src/shogun/base/SGObject.cpp
Expand Up @@ -1021,8 +1021,8 @@ void CSGObject::save_serializable_post() throw (ShogunException)
}

#ifdef TRACE_MEMORY_ALLOCS
#include <shogun/lib/Set.h>
extern CSet<shogun::MemoryBlock>* sg_mallocs;
#include <shogun/lib/Map.h>
extern CMap<void*, shogun::MemoryBlock>* sg_mallocs;
#endif

void CSGObject::init()
Expand All @@ -1034,7 +1034,7 @@ void CSGObject::init()
#ifdef TRACE_MEMORY_ALLOCS
if (sg_mallocs)
{
int32_t idx=sg_mallocs->index_of(MemoryBlock(this));
int32_t idx=sg_mallocs->index_of(this);
if (idx>-1)
{
MemoryBlock* b=sg_mallocs->get_element_ptr(idx);
Expand Down
8 changes: 4 additions & 4 deletions src/shogun/base/init.cpp
Expand Up @@ -11,12 +11,12 @@
#include <shogun/base/init.h>
#include <shogun/mathematics/Math.h>
#include <shogun/lib/memory.h>
#include <shogun/lib/Set.h>
#include <shogun/lib/Map.h>
#include <shogun/base/Parallel.h>
#include <shogun/base/Version.h>

#ifdef TRACE_MEMORY_ALLOCS
shogun::CSet<shogun::MemoryBlock>* sg_mallocs=NULL;
shogun::CMap<void*, shogun::MemoryBlock>* sg_mallocs=NULL;
#endif

namespace shogun
Expand Down Expand Up @@ -54,7 +54,7 @@ namespace shogun
sg_math = new shogun::CMath();
#ifdef TRACE_MEMORY_ALLOCS
if (!sg_mallocs)
sg_mallocs = new shogun::CSet<MemoryBlock>(631, 1024, false);
sg_mallocs = new shogun::CMap<void*, MemoryBlock>(631, 1024, false);

SG_REF(sg_mallocs);
#endif
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace shogun
{
#ifdef TRACE_MEMORY_ALLOCS
list_memory_allocs();
shogun::CSet<shogun::MemoryBlock>* mallocs=sg_mallocs;
shogun::CMap<void*, shogun::MemoryBlock>* mallocs=sg_mallocs;
sg_mallocs=NULL;
SG_UNREF(mallocs);
#endif
Expand Down

0 comments on commit f04183b

Please sign in to comment.