Yes, you can disable what you don’t need. That is perfectly safe.
What takes a bunch of memory is and will always be the scripting components. Lua for example has to generate wrappers for every exposed API and AngelScript also has to generate a ton of function calls for registering the API.
Second would be disabling the Database component if you don’t need it. No reason to include SQLite or ODBC(?) into your code if you don’t need it. Followed by the web-server if you don’t need that too.
IK component can also be disabled since I’m guessing you won’t be using that either.
The NavigationSystem can probably be disabled too if you don’t need it.
Not sure if the WebP image library can be disabled if you can live with just the standard DDS/PNG/JPEG/BMP/PSD etc. formats. I’ll have to look into that to say for sure.
Network and Physics can probably be disabled too without any effects. The network can definitely be disabled if you don’t need it.
Not sure if the 3D physics can be omitted if you only need 2D scene and physics. A more experienced used
can tell you that for sure. Or how it can be achieved. I only know you can omit the 2D component entirely.
Disabling most of these can significantly reduce the size of your executable. Especially the script components.