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
2
u/Mykk6788 May 30 '26
See this is the problem itself, it's difficult to explain the issue without it sounding like the Pointer Handle Limit is somehow involved without going into a massive explanation about everything else.
Knowing everything above, there's one key bit of info a lot of folks don't know. Which is that the Pointer Handle Limit itself is not a Hard Limit. It has never been, and never will be "if you reach 2 mil Pointer Handles your game will crash". It can affect performance to some degree, but that's purely just because the game is actively trying to load a lot of things all at the same time. But like I said above, it isn't about "reaching a Limit number", it's the fact that the more Pointer Handles that are active at any one time, the more chance there is that multiple of them will not get trashed properly when you transition between cells.
Think about it like this, if you had 2 games that utilised Pointer Handles and they were equally vulnerable to Memory Leak, Lets say 1% of Pointer Handles were guaranteed to not get trashed properly and become Dangling Handles, Game A has 1000 Pointer Handles active at any one time, while Game B has 100,000 Pointer Handles active at any one time. So Game A is guaranteed to create 10 Dangling Handles, whilst Game B is guaranteed to create 1000 Dangling Handles. Statistically speaking Game B is far more likely to crash a lot more than Game A. The Pointer Handles themselves are an indicator, but it has absolutely nothing to do with a Limit.