Gauging interest in this. So right now in OpenMW you have access to these settings:
lua debug = true
lua profiler = true
small alloc max size = 1024
log memory usage = true
Simple Setup (vanilla OpenMW)
log memory usage = true dumps every memory event (malloc, realloc, free) to the log, as long as the allocation is larger than small alloc max size. You can lower that threshold to capture more.
From this you can reconstruct:
- Time series of memory usage per script
- Time series of memory events per script
- Garbage collector hits (when memory drops across multiple scripts simultaneously)
- Rough idea of how "busy" each script is
Basically - how much memory is each mod using, how often is it allocating, and how often and how hard the GC hits.
Advanced Setup (requires custom OpenMW build) Since we already have frame data on F3 and the Lua profiler on F10, we can pipe both out every N seconds to get a much richer time series.
lua debug = true
lua profiler = true
small alloc max size = 1
log memory usage = false
profiler stats log interval = 0.5
log memory usage is turned off here because with small alloc max size = 1 it would spam the log. Instead we rely on the profiler dumping stats every 0.5 seconds, which gives us ops, frame timing, memory, and GC detection all in one pass. Same idea as above but you also get per-script ops counts tied to frame timing, so you can see which scripts are actually eating your frametime vs just churning memory. The collection is also less frequent so you can set the alloc threshold much lower without drowning in data.
The graphs/CSVs I'm sharing here are from the advanced setup since it had more info. But if people are interested I can provide tooling for the simple setup too - it's less work to get running since it doesn't need a custom build.




but doesn't time vary on the users computer?
I guess the main problem was this was sort of thought up as a quick (that ended up being a lie) way to find things that were probably eating performance on the big mod pack. And I was like eeeee I don't want this to rot on my computer, but I don't want to hand over something that doesn't include many asterisks explaining some background info. Or if it was easy to address them. Or idk. Tbh.


. But it does kind of suck, because a lot of the entry jobs are something a senior dev can oversee an llm doing. Same thing in stats, all the basic graphs stuff would be recent grads, but now they can just 'ask' for it. Read the graph. And then go on their way.
)
. It's like a nice walled garden where everything just works as long as you don't try to step out of line.