Heap Limit Mods

Heap adjusters are there to help prevent memory allocation errors - specifically an error called ERR_MEM_EMBEDDEDALLOC_ALLOC.

What exactly is the heap? The heap is memory used by programming languages to store global variables. By default, all global variables are stored in heap memory space. It supports Dynamic memory allocation. Source: Stack vs Heap Memory – Difference Between Them

According to one of the mod authors, the default game heap size is 466MB. This is identified as vanilla heap size in a log file. There are two versions of these mods available and you should only install one. They aren't mandatory but they should be, for anyone serious about modding and stability.  These are the 2 heap mods described in brief.

Heap Limit Adjuster 650 MB of heap! by hydrogen-cfx (FiveM Systems Division)
Last Updated: October 06, 2017. This mod consists of one plugin, to be installed in the game folder (root). It will be loaded by dinput8.dll. It is set at 600MB and isn't configurable. There is one file:  GTAV.HeapAdjuster.asi

HeapAdjuster by Dilapidated
Last Updated: August 03, 2019. This is a newer version based on (a fork) of the citizenfx gtav-heap-adjuster (FiveM) above. It differs from the older one by having a configurable ini file and also generates a log file. It is also installed in the game folder and loaded by dinput8.dll. It is set higher at 750MB and is configurable through the included ini file.

Setting the heap in this mod's ini file above 750MB will not guarantee better results. Although I could not find references specifically for GTA5, based on Java documentation the maximum heap limit is about 2 GB (2048MB). In fact performance and stability could suffer if you exceed that. However feel free to experiment. This mod is packaged with 2 files and will generate a log file:

HeapAdjuster.asi
HeapAdjuster.ini
HeapAdjuster.log
(generated after first run)