Open the Minecraft Launcher
Go to Installations
Select the profile you want to change
Click More Options
Find the JVM Arguments field
Look for the part that says -Xmx
Change the number after -Xmx to the amount of RAM you want to assign
Use M for megabytes or G for gigabytes
Example: -Xmx4G
Save the changes
Launch Minecraft
Make sure not to assign more RAM than your computer can spare
If you use a modpack launcher, change memory settings in that launcher instead
