AnsweredAssumed Answered

Why does a local c++ new over-write global c++ class constructor heap space on Blackfin 561?

Question asked by jjahlers on Mar 28, 2017
Latest reply on Apr 12, 2017 by Kader.M

Why does a local c++ new over-write global c++ class constructor heap space on Blackfin 561?

 

//outside any funciton scope, aka a global c++ class that initializes on the heap during startup code execution (prior to main)

MyClassName myclassinstance;

 

typedef struct queue
{

//stuff
} MY_STRUCT;

 

myfunction()

{

pnew = new (MY_STRUCT);//this corrupts the same heap memory as myclassinstance (corrupts memory)

}

Outcomes