Maximum asset file limit in windows? MC freezes

34 views
Skip to first unread message

Ryan McQuaid

unread,
Sep 22, 2023, 8:22:15 PM9/22/23
to MPF Users
Hi all,

I'm trying to bulletproof the existing code for Sonic so I can tour it on a few more shows. A lot of people have told me they are sad they never got a chance to play. I have a problem that I think I'm on the right track to fixing but I've run out of ideas on how to implement the solution. 

Basically, if I load too many assets (over 1000), the mc will freeze and crash. This currently happens at startup because I am preloading all assets. I've had nothing but problems with game performance when trying to load things on_demand and I have certain assets I can't load on demand due to the custom asset manager I'm using. I have a crazy fast m.2 SSD and I've been down that road before. I just want to preload everything and not worry. Anyways, if I remove 30 or so files from loading it stops breaking. File size doesn't matter, only count. I'd just find a way to trim 30 or so files out, but I want to add more. Ive done research and found that 1024 is a common limit on the number of open files an application can access at the  os level and that seems to be the issue I'm running into. There is an old post about this being an issue on linux here:


Apparently in Linux this is an easy fix, but is somewhat more complicated in windows. A stack overflow post appears to detail the equivalent setting as win32file._setmaxstdio (image attached)  Ive tried adding this to mc.py along with the proper import, and while it didn't crash anything it didn't help either. I've reached the end of my ability to troubleshoot and implement the fix I may have found as I'm just not a software guy even though I pretend to be sometimes. 
Screenshot_20230921-215553.png
Screenshot_20230921-215505.png

Avery Tummons

unread,
Sep 22, 2023, 9:43:38 PM9/22/23
to mpf-...@googlegroups.com
No idea, but did a quick search. I know MC is compiled on C and Cython. Wonder if you need that for python and this for C. Maybe one is trumping the other. Can you test by printed out to logs and ensure the value is actually being set. Or debug through to check.

import ctypes
print("Before: {}".format(ctypes.windll.msvcrt._getmaxstdio()))
ctypes.windll.msvcrt._setmaxstdio(2048)
print("After: {}".format(ctypes.windll.msvcrt._getmaxstdio()))

Sent from my iPhone

On Sep 22, 2023, at 7:22 PM, Ryan McQuaid <mcqu...@gmail.com> wrote:

Hi all,
--
You received this message because you are subscribed to the Google Groups "MPF Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpf-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mpf-users/b2156bc1-770e-4743-ad9b-8794258049ccn%40googlegroups.com.
<Screenshot_20230921-215553.png>
<Screenshot_20230921-215505.png>
Reply all
Reply to author
Forward
0 new messages