new(fx)MyClass()
This is called "placement new" and will actually call a constructor to actually create an object.
Until you created that object in the memory you allocated, it simply does not exist (as an object of that type) so it is just raw untyped memory that you cast to something, which results in undefined behavior.
I would suggest that you make your function a template like.
template<class T>
T* allocateEffect() { return new (allocate_some_memory(sizeof(T))) T(); }
adding proper variadic templates and forwarding for constructor arguments is left as an exercise to the reader.