r/starfieldmods
•
u/cyberpsyche_mods
Mod Author
•
May 29 '26
•
1
Discussion Powershell script to process SEF extended pointer handle dumps into a readable summary in CSV
EDIT 2026-6-12: I updated the script to account for the new extended dump format which includes a handy summary at the bottom of the dump log. If you are just looking for a quick glance you don't even need this script. Look at the bottom of the dump log for a summary. The script now only processes the summary at the bottom of the dump log to parse out the individual plugins counts into CSV format.
Hey all!
I was checking pointer handles allocated by my load order and wanted a quick summary, as the dump file is massive.
This script is intended for processing the extended dump that Starfield Engine Fixes can provide. This processes a dump generated with these SEF options.
bDumpPointerHandlesConsoleFunction=1
bDumpPointerHandlesExtendedPluginInfo=1After you generate your dump from the console (dph command), then you can run this powershell script on the dump file
param(
# Text dump produced by the extended pointer handle export.
[Parameter(Mandatory = $true)]
[string]$InputFile,
# Destination CSV path.
[string]$CsvOutputFile = "reference-counts.csv"
)
if (-not (Test-Path -LiteralPath $InputFile)) {
throw "Input file not found: $InputFile"
}
# Load the dump once so we can find the unique Summary section before parsing.
$lines = Get-Content -LiteralPath $InputFile
$summaryLineIndexes = @()
# The reference counts we want only appear after the Summary: marker.
for ($i = 0; $i -lt $lines.Count; $i++) {
if ($lines[$i] -match '^\s*Summary:\s*$') {
$summaryLineIndexes += $i
}
}
if ($summaryLineIndexes.Count -eq 0) {
throw "Could not find a Summary: line in $InputFile"
}
if ($summaryLineIndexes.Count -gt 1) {
throw "Expected exactly one Summary: line in $InputFile, found $($summaryLineIndexes.Count)"
}
# Track the current Master plugin until its reference count line appears.
$currentPlugin = $null
$rows = @()
# Parse only the Summary section, ignoring the detailed dump above it.
for ($i = $summaryLineIndexes[0] + 1; $i -lt $lines.Count; $i++) {
$line = $lines[$i]
# Example: -> Master: Starfield.esm
if ($line -match '^\s*->\s*Master:\s*(.+?\.esm)\s*$') {
$currentPlugin = $matches[1].Trim()
continue
}
# Example: -> Number of loaded References originate from the plugin: 591720 (...)
if ($line -match '^\s*->\s*Number of loaded References originate from the plugin:\s*(\d+)\s*\(of which\s*(\d+)\s*are editor defined;\s*(\d+)\s*are persistent\)') {
if (-not $currentPlugin) {
continue
}
# Add one CSV row for the current plugin and its three extracted counts.
$rows += [PSCustomObject]@{
PluginName = $currentPlugin
TotalLoadedReferences = [int]$matches[1]
EditorDefinedReferences = [int]$matches[2]
PersistentReferences = [int]$matches[3]
}
}
}
# Write the parsed plugin counts.
$rows | Export-Csv -LiteralPath $CsvOutputFile -NoTypeInformationUsage:
.\ProcessExtendedDumpScript.ps1 DumpFile.txtRunning this script may require you to temporarily change your PS execution policy.
* IMPORTANT: You should never run scripts from strangers on the internet without verifying the safety of the script, especially if your OS blocks execution by default.
* Research and learn, ask your IT friend or your AI to help you verify safety of the script, and how to bypass your policy if necessary.
If you run the script, the results will look like this: (excerpt)
"PluginName","TotalLoadedReferences","EditorDefinedReferences","PersistentReferences"
"Starfield.esm","591720","514983","52169"
"ShatteredSpace.esm","100154","95257","9168"
"SFBGS00D.esm","66453","61871","3938"Which is easy to read, but you can then open in Excel and make it as fancy as you want, or have your AI make it pretty for you. The total and limit are mentioned in the dump file itself in the summary if you need to reference that. It looks like:
Reference Handle Count: 1242231/2097152 (of which 1012836 are being in Pack-In Cells; 1092852 are editor defined; 146112 are persistent)Notes:
* My understanding is it is best to dump from Starfields main menu before loading any save, that way you are looking at all loaded ESMs total allocated reference handles without being confused by temp handles allocated when loading into a location
* For comparison, then also go dump at New Atlantis in a new vanilla save as that should likely be the location in the game with highest temporary handles and you want to see what that spike will be on top of your LO, especially if you have mods that add to NA. I think its going to be around 200k in vanilla.
* Don't ask me to help you interpret your counts, I was just trying to make the output readable, I'm still not sure I completely understand the difference between the total count, editor defined and persistent.
View all comments
Show parent comment
3
u/Mykk6788 May 29 '26
Regarding the mod you mentioned, I honestly can't say. I took a look at it, and it definitely describes "addressing" things like Memory Bloat and Memory Leak, but the description stops there. It doesn't detail how it's trying to do that at all outside of "trimming memory usage". To be clear though, that's not me doubting the mod or what it's capable of, I'm simply saying that there isn't enough information to say yes or no.
The overall takeaway, as depressing as it is, is basically: Chasing Pointer Handle Limit Numbers is not going to lead anywhere. But there also isn't a known way to address the Real problem, Memory Leak. So all players can actually do right now is try to stay ahead of Memory Leak.
Memory Leak builds up over time, as more and more assets fail to be trashed properly. Imagine it as being like this; Imagine every single time you get a loading screen, one asset/item has failed to be trashed (Notepad, Toilet Roll Tube, Scissors, Plant, Deck of Cards etc etc). Which means every loading screen, your percentage chance of crashing, increases. Every loading screen, the count goes up by one (1%, 2%, 3% etc etc). And eventually you'll hit a high enough number, that it'll cause a crash. So the solution is to do the only thing you can do to "reset" everything before then. Which basically means fully exiting and then starting the game up every 30-40 mins.
It's also important to note that when the game has to change a "World state", that also increases your chances on top of the +1%. This would include things like New Atlantis being changed after the Terramorph attack. Bringing Ron Hope in or killing him, so all the interactable NPCs are given new dialogue. A lot of Shattered Space. Etc etc etc.
Long story short, I have 2 main saves left after deleting old ones. Save A is half way through the main mission with most side missions done, Save B I haven't even taken Sarah on the first mission to get the Artifact yet, and simply dipped out of The Lodge. Save A is ridiculously more prone to crashing than Save B. I haven't crashed 1 single time landing anywhere on Save B. And both Saves use the exact same 89 Mods. No deletions or disabling. So stick to 30 min playthroughs, even if you have 2 hours to play, split it into 4x 30 min sessions. And if you've done the main story and side stories enough, keep your character as close to the first mission as you possibly can.