TL;DR:
Look for a file called package.json in the root of your RPG Maker project, and add one line to it:
{
"name": "rmmz-game",
"main": "index.html",
// vvv THIS LINE vvv
"chromium-args": "--force-color-profile=srgb --disable-features=GwpAsanMalloc,GwpAsanPartitionAlloc",
// ^^^ THIS LINE ^^^
"window": {
...
}
By adding --disable-features=GwpAsanMalloc,GwpAsanPartitionAlloc to your package.json file, your game will stop randomly crashing on launch on M-series Macs!
Full Post:
Unbroken Fun is a husband and wife duet. We haven't really released a game yet but we've been having fun for a few years learning and experimenting and seeing what we can build, and we have a JRPG in the works expected to launch next summer.
The Husband
Nearly a year ago I was developing my RPG Maker game on Mac and noticed that it would randomly crash when playtesting. I looked into this and found many posts with the same symptoms, but none with a solution:
At the time I dug into the crash report, looked for debug symbols on the referenced dynamic libraries, and tried to trace the exact cause. After about 3 hours, I had narrowed it down to: "there is a bug in Chromium's custom memory allocator, which bypasses the normal system allocator, causing it to free a pointer improperly".
For those who don't care for a technical explainer and just want to jump to "how we fixed it", CTRL+F for "The Wife", below.
🚨🚨 NERD ALERT 🚨🚨
[Nerd Warning]
Internally an RPG Maker game is really just a website. There is an HTML file (created by Kadokawa, the makers of RPG Maker) which just loads a bunch of JavaScript and renders a <canvas> element to the page.
This JavaScript contains the full logic of the game engine, and loads game data from JSON files. The "game" you made (all the maps, characters, actors, items, skills, etc) are just these JSON files. Plugins (which mutate how the game engine works) are just JavaScript files that are loaded *after* the core game engine is loaded, and can therefore overwrite any of the core game engine methods.
In order to render this web page, you need a browser. Technically you can open any RPG Maker game by just double-clicking the "index.html" file to open it in your web browser of choice (although you will probably get an error like "Your browser is not able to read local files").
There are applications called "bundled browser frameworks" which contain a web browser along with several hooks to give the browser access to system information (like reading local files). Examples include Electron, Tauri, and of course: NW.js (which is provided by RPG Maker).
Different bundled browser frameworks will come with a different "bundled browser". In the case of NW.js, it comes with Chromium -- an open source fork of Google Chrome.
Browsers, like all programs, have "memory". They keep track of things like "what page are you on", "what have you typed into this text field", or "what are we currently drawing on the screen". For RPG Maker games they also have to track the game variables, switches, character HP and MP, and so on. When it comes to memory, there are broadly two options for a program:
* The stack -- when the program is first started, the operating system sets aside a portion of RAM and says "this is your RAM for you to store any data you need". But often this isn't enough. That's why we have...
* The heap -- after a program has started running, if it decides that it needs more RAM then it goes to the Operating System and asks for more. The OS finds some free memory, assigns it to the program, and hands it back
On its own this is a simple system that works. But what happens if Program A on your computer starts reading memory that belongs to Program B? Now that game you bought from Steam is reading the password you're typing into your bank website!
There are two common tricks used to prevent this.
The first is Address Space Layout Randomization (ASLR). So when you ask the Operating System for memory, instead of saying "you are allotted bytes 1,000,000 through 2,000,000 of the RAM" and then letting you write to those million bytes directly, the Operating System sets aside one million bytes **somewhere** (possibly bytes 23,500,000 through 24,500,000) and TELLS YOU that it allotted you bytes 1,000,000 through 2,000,000. When you then say "I want to write to byte 1,500,000" the Operating System looks at what's called the "Page Table". The Page Table tells the Operating System "I gave Program A access to memory starting at X, but told them it started at Y... so if they want to access memory address Z then I should compute (Z minus Y) plus X to find the *real* memory location".
By using ASLR, your program doesn't actually know where its memory lives, and it doesn't need to. Because so long as it keeps its writes within the memory it owns, the OS will handle everything.
The second trick is the Memory Management Unit (MMU). When an entry is written to the Page Table, it not only contains "I assigned Program A bytes X and called it bytes Y", but it also stores a handful of "permission" flags. Things like "the data stored in these memory addresses should NEVER be interpreted as code" or "the data stored in these memory addresses should be READ ONLY, not writable".
All of this protects you from OTHER programs... but what about from YOUR OWN program? Suppose a program is assigned some chunk of RAM as before, and it decides "I will store the admin password in byte 1,500,000" and then "I will store whatever the user typed into this textbox into byte 1,000,000". If the user types 500,000 bytes into the textbox, then it will start overwriting the admin password! This is called a stack overflow.
To protect against stack overflows, memory allocators will often use what are called "Guard Pages". When you request some amount of space (e.g. maybe you request 1 million bytes) it will actually allocate just a LITTLE bit extra. Maybe 1.1 million bytes. The first and last bytes (in this example, the first 50,000 and last 50,000 bytes) are then marked with permission flags saying "no one can read, write, touch, execute, or do ANYTHING to this memory". So if you attempt to type more than you're allowed to into a textbox, it will overflow into one of these "guard pages" and the program will crash before letting you modify the admin password.
So... what is a "memory allocator"? The memory allocator is a small program that talks to the Operating System on your behalf. When you say "I need one megabyte of RAM" you don't ask the Operating System directly. You ask the memory allocator, which asks the Operating System. This may seem like a silly middle manager, but it exists for a reason.
Because programs will often thrash: "give me 1 megabyte", "okay, I'm done with it, you can have it back", "wait, I need a new megabyte", "okay, I'm done with it now", "hold up, I need another!"
A memory allocator adds a layer of intelligence. It might say "I know you just told me you were done with this megabyte, but I'm going to hold onto it for a minute just in case you need it later. If you don't use it for 10 minutes, then I'll release it". Memory allocators can also do things like "when you ask for one megabyte, I'll go ahead and request 10 megabytes so that the next time you ask for a megabyte it's already ready to go". Or they can do things like "we have 10 individual single megabyte chunks of RAM spread all over the place... let me request a single 10 megabyte chunk and move everything into it so that your memory is contiguous".
Most programs will use the "standard library" memory allocator. The term "standard library" refers to a collection of programs provided by the Operating System that adhere to a predefined specification. So long as you're using an Operating System that supports the "standard library" (almost all Operating Systems) you can trust that these programs will exist and will take the same inputs and provide the same outputs, even if their specific implementations differ slightly.
But now we get to Chromium... Chromium has a custom allocator. It does this because different types of data have different behaviors. JavaScript variables may need to be allocated and deallocated more frequently than page rendering buffers. Network requests in flight behave differently than text typed into textboxes. The browser takes advantage of how different types of data behave to optimize how the data is stored, how it's allcoated, how it's deallocated, and how it's accessed. And Chrome's custom allocator, of course, uses guard pages.
---
Now that you understand memory allocators, MMU, ASLR, page table entries, permission flags, and guard pages... there's two more small things you need to know.
The first is Instruction Set Architectures. As you probably know, programs are "just 0's and 1's"... but how does a computer look at a string of 0's and 1's and know "I should add two numbers together" or "I should open a file"? The list of things that a computer can do is known as its "instruction set". When a processor is designed, the chip manufacturers will come up with a list of all actions they want the processor to be able to perform and map these actions to numbers. For example:
* 0001 could mean "add"
* 0010 could mean "subtract"
* 0011 could mean "multiply"
* etc
In order for a program to run on more than a single computer, there are standards. Instead of reinventing the wheel, a chip manufacturer will choose an existing list of actions and say "I will adhere to this list". The most common ones are:
* x86 - used by Intel and AMD
* ARM - used by Apple Silicon
* RISC-V - used in microcontrollers and embedded devices
Older Mac computers used Intel chips, and so they ran x86 programs. Newer Mac computers (M1, M2, M3, M4, and M5 Macs) are using Apple Silicon chips, so they run on ARM.
Using a different instruction set means that a program may say "0001 (add)" and if you try to run it directly then the computer wil interpret it as "0001 (delete everything and shut down)". This is hyperbole, but it really is like trying to have a Frenchman follow Chinese instructions. They're different languages, so the computer simply doesn't understand what to do.
Enter "Rosetta": a translation layer that Apple created so that old Mac programs can run on new Macs. Rosetta will translate x86 instructions into ARM instructions **in real time** while the program is running.
For the most part, this is a lossless conversion. The concept of "adding" is the same whether you're on Intel or Apple Silicon. But sometimes it's not so simple. The Intel processor has special instructions like "take this buffer containing 16 numbers, and simultaneously add something to all of them" (known as a SIMD instruction - Single Instruction Multiple Data). If Apple Silicon has no such instruction, then it can't just directly transcribe one instruction code to another. It needs to replace a single instruction with a loop walking over each number one at a time.
When it comes to the MMU, the way x86 and ARM handle page tables and memory allocation is **just different enough** that it can lead to issues...
The final thing you need to know in order to understand the bug is what a "pointer" is. This whole time I've been talking about "data" pretty generically. That programs need to store "data" and that they then read this "data". But how does the program know that the admin password is stored at byte 1,500,000 and not some OTHER byte?
For programs that always use exactly the same amount of memory, you can just hard-code the offsets for things. "We will always store the player's current HP here, we will always store the identity of the enemy you're currently battling there"... but some programs may change how much memory they need from time to time. A browser doesn't know how many textboxes will be on a page until after the page loads. Every website is different, so every website's memory needs are different.
For this, we introduce a new "kind" of data: the pointer. A pointer is just a number. It's stored as an integer in RAM. But instead of reading the value directly (e.g. "this number has a value of 1,500,000"), you load the memory stored at the address there and read THAT. "The number says 1,500,000.... let me go read the bytes starting at the 1,500,000th in memory and that's the ACTUAL data".
Using pointers you can do things like "I know this page will have textboxes, but I don't know how many... so after the page loads I'll count how many textboxes I need, and allocate some bytes for each one. I'll then point to the start of this allocated memory... then when you want to read the contents of textbox 3 you will jump to this list, skip past the first few bytes (textboxes 1 and 2), and the next few bytes will point to whatever area in RAM was allocated specifically for THAT textbox". So our program has one **guaranteed** number it will store (the starting point of the "list of textboxes") which is can hard-code the memory offset for, followed by a bunch of **dynamic** numbers it will store (the starting points of each individual textbox) which get allocated and pointed to at runtime.
So now we can finally get to what's going wrong:
**Sometimes**, and I don't know why, on M-series Macs using Rosetta to run x86 programs, Chrome will allocate memory (including guard pages) and then create a pointer POINTING AT THESE GUARD PAGES. It then attempts to read the data stored at this pointer, which hits the permission error (reading a guard page), and crashes the program.
My suspicion is that the x86->ARM conversion isn't handling ASLR correctly, and so the pointer offset is wrong. Although I don't know exactly.
[/Nerd Warning]
Having reached this conclusion, I didn't know how to proceed. The issue was with Chromium, so this meant it would also affect Electron builds of the app (which rely on Chromium) and there was nothing in my game logic that I could change to fix it, and nothing Kadokawa could do to fix RPG Maker MV or MZ to fix it. This felt like something we just had to live with until the folks at Google benevolently pushed a fix.
The Wife
Last night, I was adding bad dad jokes to random buckets near the taverns in our game. I was working from my MacBook. When launching the playtest, the game would randomly crash.
I asked my husband, who had been coding professionally since 2009, if he could fix the crashes. He explained to me that he had looked into this 10 months prior and determined it was a Chromium bug and there was nothing we could do. Also, he was busy making chocolate milk for children.
I said "fine, I'll ask Claude. He does things for me you can't". I proceeded to open up Claude Fable and say "use all our tokens to fix my husband's incompetence".
In an epileptic seizure style diagnostic mode it proceeded to open and close the game repeatedly recording the frequency of crashes for statistics.
After realizing the crashes occurred approximately 15% of the time, a deep dive into the Chromium internals revealed Google needs people better at memory allocation programming.
Then Claude said "This is a simple 1 line fix to the JSON".
I was like "My husband will fix it if you break it - let's go".
And then it was fixed and we lived happily ever after knowing we have to clean up after companies with 1000s of employees to release a game that probably won't make back the money we spent on voice acting snippets.
Honestly though the peace of mind and time savings from not having the game crash every 1/10 launches or more is WORTH!
Just thought we'd share with anyone still using RPG Maker MZ on an M-series Mac in 2026 (Thumbs up if you are!)