• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

SOLVED Memory Allocation Crash

Neptune

Member
The function ds_map_secure_save has been crashing for players when trying to save anywhere from 250-350 mb (crashes are not consistent).
GML:
FATAL ERROR in
action number 1
of  Step Event0
for object o_main_control:

Memory allocation failed: Attempting to allocate 261909033 bytes
I've scrutinized my data, and I'm pretty certain it's fine. Any ideas what might cause this?
Is this likely something on my end, or rather an issue with the function and data amount?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Sounds simply like the device doesn't have enough memory for the file that's being written... That said, might be worthwhile filing a bug report (supply a link to the exported YYZ of the project) and ask YYG to check it out.
 

Evanski

Raccoon Lord
Forum Staff
Moderator
261909033 bytes
thats 262 megabytes of memory, thats a lot of memory to be eating up, if its for a mobile game thats why it crashes for some people, I would look into finding a way to compress the data to be on the safe side, but it depends on your target platform
 

Neptune

Member
It's not mobile, though it has been laptops (16 gb ram).
Anyways, switching to using ini files seems to have fixed the issue... Not sure what it didn't like about ds_map_secure_save.
I may file an actual bug report when time permits.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I may file an actual bug report when time permits.
Please do. If there is a data limit on what the secure save file can store, then it should be documented. I would also point out that INI files can ALSO have a data limit on them, and I've found them to be VERY unreliable for large amounts of data. Really your best bet would be to use a text file and just use the ds_map_write() function, or use te JSON functions to convert the map to JSON then write that to a text file (you can even do a base64 encode on it to make sure it's not human readable).
 

Neptune

Member
@Nocturne @EvanSki
Just to follow up.
I believe I fixed the issue. I converted to using ini files, and then finally just text files for writing/reading... All of them crashed with the amount of data. Sometimes on the write, sometimes when closing the files etc.

I think it was just the size of the data -- Instead of cramming it all into one ds_map, I've resorted to making ~10 smaller files. This seems to save/load much quicker, and there has not been any allocation issues since.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I believe I fixed the issue. I converted to using ini files, and then finally just text files for writing/reading... All of them crashed with the amount of data. Sometimes on the write, sometimes when closing the files etc.
Good that you've solved it, but bad that the issue persisted with text files as it really shouldn't. I'd really appreciate it if you could file a bug report and include a link to the project (that crashes). I feel this is something that should be looked at, as it could be an issue with the ds_map functions or the general saving functions...
 
Top