Memory can be allocated up to main :
static int* x = new int(1); int main() { return *x; }
And you can also make your memory manager a global variable,
but you cannot force a certain order of initialization of global variables. (at least in standard C ++)
On Windows, you can put the memory manager in a DLL and it will be initialized before the entry point of the application is called, but still something else can allocate memory earlier - another DLL or CRT of your DLL.
Abyx
source share