Writing a static value returning method In Dll?


I wrote a custom Memory Manager and override global new and delete.
In order to get a memery manager singleton , I Wrote a function that return a static refernce instance in dll. something wrong.

//override function
FORCEINLINE void* operator new[](size_t uiSize)
    return GEngine::GMemObject::GetMemManager().Allocate((unsigned int)uiSize, 0, true);

//get static value reference function
GDebugMemManager& GMemObject::GetMemManager()
    static GDebugMemManager debug_manager;
    return debug_manager;

//use code
GTempString(unsigned int len) 
    str = G_NEW T[len];

It have no wrong before it runs into function GetMemManager…But when it tries to return,It does’t work!!just like entering an endless loop… I have no idea.

the auto window change to gray,the program is running but not to next step

Source: Windows Questions C++