Avoiding overriding the global operators new, delete

Hi everybody,

In one of my game modules, global operators new, delete cannot be overridden. To do this, in my module I can define a custom macro IMPLEMENT_MODULE (for example IMPLEMENT_MODULE2) where I will delete the line for overriding the operators new, delete:

#if IS_MONOLITHIC

#define IMPLEMENT_MODULE2( ModuleImplClass, ModuleName ) \
		static FStaticallyLinkedModuleRegistrant< ModuleImplClass > ModuleRegistrant##ModuleName( TEXT(#ModuleName) ); \
		extern "C" void IMPLEMENT_MODULE_##ModuleName() { } \
		PER_MODULE_BOILERPLATE_ANYLINK(ModuleImplClass, ModuleName)

#else

#define IMPLEMENT_MODULE2( ModuleImplClass, ModuleName ) \
		extern "C" DLLEXPORT IModuleInterface* InitializeModule() \
		{ \
			return new ModuleImplClass(); \
		} \
		extern "C" void IMPLEMENT_MODULE_##ModuleName() { } \
		UE4_VISUALIZERS_HELPERS \
		//REPLACEMENT_OPERATOR_NEW_AND_DELETE \
		PER_MODULE_BOILERPLATE_ANYLINK(ModuleImplClass, ModuleName)

#endif //IS_MONOLITHIC

And now I announce the implementation of my module:

IMPLEMENT_MODULE2(FMyModuleModule, MyModule)

This seems to work, provided I don’t use UObject-inherited objects in this module. But I don’t really understand why the global operators new and delete are overridden, so I suspect there may be potential problems.

Can I use this code and what potential problems might arise when using it?

Hey

Did this work for you at the ened?

Tried on my end lately but got some compile errors, looks like stuff cahnged in 5.5.4 +? Tricky.