Jump to content

Papyrus compiler - running out of memory.


Recommended Posts

Posted (edited)

Hello!
I have started building quests with more complex scenes and have come across a strange limit., 

I have built a quest that has 29 fragment  scripts 
When the compiler spawns 29 threads to compile all of them at the same time, it runs out of memory and stop compiling things.
20 compiled fine is fine, 29 not so much.


The error is something like 
 papyrus error while attempting to read script [various dependencies] Exception of type 'System.OutOfMemoryException' was thrown.

The papyrus compiler is 32 32-bit executable, so it can address a max of 2 GB of RAM. I have 64 GB RAM on the machine, so it is not a problem of ram availability. 

 


Has anyone come across this issue and how is it fixed? Does it have a solution?
Do I need to simply split my scenes with fragment scripts in two separate quests instead of one?
Do I need to manually compile the script with a lower thread count,   instead of using the "recompile all payrus scripts" button in the CK?

This quest does not have particularly large scripts (other ones have MUCH larger ones, and they compile instantly, but true, their fragment count is lower).
I assume if I could limit the number of parallel threads that the compiler spawns simultaneously, the compiler should be able to compile them in a sequence just fine (again, these are tiny fragments just with one or two lines). 

Edited by MSM_Alice
Posted

Increase your virtual memory. I had it at “0” and that used to happen to me. My system would hang if I was testing the game + I had an exterior open in the creation kit, I also had the same problem that you say when compiling. Now my virtual memory is managed by the system and everything is fine.   

Posted (edited)
6 hours ago, JB. said:

Increase your virtual memory. I had it at “0” and that used to happen to me. My system would hang if I was testing the game + I had an exterior open in the creation kit, I also had the same problem that you say when compiling. Now my virtual memory is managed by the system and everything is fine.   


Hmm, my paging file was 4 GB, increased it to 9.
Unless this is a specific CK virtual memory setting 


There is no system wide hang, everything else on the system ( including the CK itself)  works flawlessly before and after the error.
Just the papyrus compiler who has the issues.


During compilation, it hits close to the inevitable 32-bit-app 2 GB addressable limit and stops compiling if more than 26-ish compiler threads for 26 scripts start compiling at the same time.
 
I am fairly sure if I could just limit somehow the number of simultaneous scripts it is trying to compile and approaches them sequentially, things would be just fine, but I don't know how to do that, apparently someone had to write a custom version of the compiler just to heave a -threads option back in 2018 or so?
Before going third party, I want to see if I can solve it with the official tools. 

Maybe it is a setting to limit how many script it should compile at the same time, or maybe for that particular quest I need to compile them manually one by one, instead of via that "Compile All Payrus  Scripts" button on the first tab of the quest. 

It annoyed me so much when I realized I had 4 hours of work on Sunday of that quest and the micro conditions and scenes and scripts and all their dependencies, and it just....  would not compile. And I had to delete a bunch of stuff just to put together a heavily watered down functional version of that. 
 

Edited by MSM_Alice
Posted (edited)

Updating this just in case there is someone who has a similar issue: 

While I did not find a reliable way to compile more than 25 scripts at once from within the CK with the  "compile all scripts" button,  I realized I can probably redesign my quest to need far fewer papyrus fragments, by triggering whatever script function I need,  by setting a certain stage and then using the native 
OnStageSet - Quest - the Fallout4 CreationKit Wiki
event to detect that stage has been set and triggering the function this way.

This way I trust I can run all the script functions that I want to run when a certain scene ends,  without needing a Topic Info fragment script at all, so the total script count on that quest stays well under the max 25-ish number so the compiler has no trouble.

Edited by MSM_Alice
Posted (edited)

One more insight (drove me crazy until I figured it out):  OnStageSet event seems to not trigger reliably ( or better said  "at all")  on quest stages that are defined but don't have at least a log entry in them.

There might be more contextual reasons for that (perhaps is not always so if other settings on the quest are different), but this is what I was able to determine empirically. To me it seems 100%  that it has to be this way or it does not work.

Edited by MSM_Alice

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...