My PC has 16 GB of RAM. Most of the time I have minecraft, discord and maybe two chrome tabs open.
The ram is distributed all by itself, you do not need to assign it and 16GB ram is even enough for cyberpunk in the highest resolution… If that is too little for minecraft, something is wrong with your pc.
With Minecraft it is not automatic, I think the basic setting is a maximum of 1GB (I think) and you can assign more to MC
I always give half of what I can.
That's my motto in life and I actually do it with everything, including Minecraft.
4GB I would give Minecraft.
It doesn't take more anyway.
If you're playing a huge modpack, it'll be up to 8GB.
I have 32 GB of Ram and only ever give Minecraft 2 GB of Ram, which is still sufficient. If you have mods installed, I recommend 4 to 6 GB of RAM.
My PC has 8GB RAM and Minecraft gets 4GB RAM because everything runs smoothly even if it needs a lot of power and DC + Spotify + Chrome in the background is no problem.