fivem icon indicating copy to clipboard operation
fivem copied to clipboard

RAGE error: ERR_MEM_MULTIALLOC_FREE crash when hitting cloth ped alternate variations limit

Open DurtyFree opened this issue 5 months ago • 18 comments

What happened?

My Cloth Tool received some new features in its recent update, properly utilizing the R* Cloth "Ped Alternate Variations" feature (pedalternatevariations.meta). This file basically defines a set of alternate models (YDD) per clothing that will applied when a certain other cloth is weared/applied on the ped. R* uses this for all sorts of things but the most common one is for hairs to not glitch thru clothes that cover the head, like for example big masks and hoodies.

When now generating a cloth resource that properly creates all the alternate definitions for berds (big masks) or jbibs (hoodies) the game will crash. The reason for the crash is a internal game limit that is hardcoded to 160 ped alternate variations per cloth, this limit is not related to the technical limitation of what is possible and seems like some console gen related limit. In theory this should be very easily patchable. Increasing this limit to 512 should be already more than enough.

Why increasing it and not keep it the way it is? Every server that wants to utilize proper handling of hairs/not glitching thru their clothes will come across this issue very quickly. In before most people didn't knew how to properly use this feature or it was to inconvenient to use but now it is easily accessible and I am already getting tons of reports with this crash.

Here is some quick maths to showcase the limits;

  • R* currently has about 81 hairs
  • Adding one new big mask with remove hairs feature, requires to add one ped alternation variation data for each hair to basically define that each hair uses an alternate model to remove the hairs when this particular big mask is worn. Thats 81 alternate variations already.
  • This leaves us with 79 own addon hairs in this case, so basically when we add 79 own hair styles (yes many server have this many hair styles) we already reached the limit. This is currently very possible
  • Additionally this scales up very quickly as the ped alternate variations on each hair style are also counted afaik

Feel free to reach out to me on Discord @DurtyFree for more information if needed.

Expected result

Loads the cloth alternate variations properly without game crash

Reproduction steps

  1. Create or have cloth resource with a lot of clothing, each defining ped alternate variations for basegame clothes and more
  2. Apply any of the clothes with too many ped alternate variations on it (for example some berd or jbib)
  3. Game will crash

For any cloth resource and detailed steps on how to reproduce it feel free to DM me (I don't want and also can't upload 2GB of cloth resource here)

Importancy

Crash

Area(s)

FiveM

Specific version(s)

FiveM 9654, Server 7290 Windows

Additional information

Some crashes on b3095 7cWgAVuPgt

[Window Title]
Error GTA5_b3095.exe!sub_141306B24 (0x52)

[Main Instruction]
RAGE error: ERR_MEM_MULTIALLOC_FREE

[Content]
A game error (at 0000000141306b76) caused the game to stop working.
Game memory error. Please reboot and restart the game.

[Expanded Information]
Report ID: si-e2043c39136746dc80bc30a254bc1f70

CfxCrashDump_2024_08_30_09_35_04.zip

[Window Title]
Error GTA5_b3095.exe!sub_141306B24 (0x52)

[Main Instruction]
RAGE error: ERR_MEM_MULTIALLOC_FREE

[Content]
A game error (at 0000000141306b76) caused the game to stop working.

Game memory error. Please reboot and restart the game.

[Expanded Information]
Report ID: si-6daf61a06e0e499197556f9447643a9d
[Window Title]
Error GTA5_b3095.exe!sub_141306B24 (0x52)

[Main Instruction]
RAGE error: ERR_MEM_MULTIALLOC_FREE

[Content]
A game error (at 0000000141306b76) caused the game to stop working.
Game memory error. Please reboot and restart the game.

[Expanded Information]
Report ID: si-db255086d4fc4a99aea892db6cdcb015

CfxCrashDump_2024_08_30_09_52_01.zip

DurtyFree avatar Aug 30 '24 10:08 DurtyFree