Memory is configured by several settings in the neo4j.conf file. The default values are quite low and it is often recommended to increase them, depending on your data and usage. Neo4j has a utility script that's used to estimate the memory required by your graph instance. The script is located in the bin directory of your $NEO4J_HOME path. When using Neo4j from Neo4j Desktop, you can open a Terminal from your graph management tab and it will automatically open in that folder. Then, you can execute memrec with the following bash command:
./bin/neo4j-admin memrec
The output of this command contains the following block:
dbms.memory.heap.initial_size=3500m
dbms.memory.heap.max_size=3500m
dbms.memory.pagecache.size=1900m
You can use these indications to update neo4j.conf (or graph settings in Neo4j Desktop) and then restart your database.