Skip to content

Commit

Permalink
Get rid of wrong SGReferencedData based assignment when using CMap
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jul 14, 2012
1 parent 5068d3e commit 3523a55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/shogun/lib/Map.h
Expand Up @@ -363,6 +363,9 @@ IGNORE_IN_CLASSLIST template<class K, class T> class CMap: public CSGObject
else
new_node=(CMapNode<K, T>*) calloc(1, sizeof(CMapNode<K, T>));

new (&new_node->key) K();
new (&new_node->data) T();

array->append_element(new_node);

new_index=free_index;
Expand Down
5 changes: 5 additions & 0 deletions src/shogun/lib/memory.cpp
Expand Up @@ -19,6 +19,11 @@ using namespace shogun;
#ifdef TRACE_MEMORY_ALLOCS
extern CMap<void*, shogun::MemoryBlock>* sg_mallocs;

MemoryBlock::MemoryBlock() : ptr(NULL), size(0), file(NULL),
line(-1), is_sgobject(false)
{
}

MemoryBlock::MemoryBlock(void* p) : ptr(p), size(0), file(NULL),
line(-1), is_sgobject(false)
{
Expand Down
3 changes: 3 additions & 0 deletions src/shogun/lib/memory.h
Expand Up @@ -60,6 +60,9 @@ namespace shogun
class MemoryBlock
{
public:
/** default constructor
*/
MemoryBlock();
/** constructor
* @param p p
*/
Expand Down

0 comments on commit 3523a55

Please sign in to comment.