Three local variables in recompiler.cpp were declared as 'static', causing
unbounded memory growth during recompilation of large executables:
- Line 2291: std::unordered_set<size_t> labels
- Line 2397: std::string tempString
- Line 2645: std::vector<uint8_t> temp
Problem:
Static local variables persist across function calls and their containers
(string, vector, unordered_set) only grow - they never shrink. When
recompiling large games with 50,000+ functions:
1. 'tempString' accumulates ALL generated C++ code across every function
2. 'labels' accumulates all label addresses from every function
3. 'temp' accumulates file comparison buffers
This was discovered while recompiling GTA IV (~18MB code, ~50k functions).
The process consumed 300GB+ RAM and crashed the server after 4 hours.
Why it wasn't caught earlier:
- Sonic Unleashed (the original target) is smaller
- Most test machines have enough RAM to complete before OOM
- The static keyword was likely intended as a micro-optimization to avoid
repeated allocations, but std::string/vector capacity only increases
Fix:
Remove 'static' keyword so variables are properly deallocated after each
function is processed. Memory usage now stays under 2GB for GTA IV.
Tested: Successfully recompiled GTA IV without memory issues.
* added extra vpkd3d128 cases from dev branch
* Fix whitespace
* fix whitespace again
* another whitespace fix
* cleaned up float16_4 case
* Fix whitespace
* Allow variable shift
* shift of 3 is not handled
* Added handling of normal compression for patching xex files
* Added normal compression handling to XenonAnalyse
* Swap calloc for unique_ptr, tidied up code layout
* Fixes loading .xex import table names when a name is not aligned to 4
bytes.
* Fixes loading .xex optional headers, adds missing case when the
header_key & 0xFF == 1
* Fixes loading .xex base address and entry point to be the XEX2
base/entry to successfully resolve all import thunks.
* Add Byte Patterns In Readme
Adds the byte patterns for instructions to make it easier for newcomers to find the right functions address.
* Added Instructions
Added extra instruction for rest, save, restvmx and savevmx
* Fix Typo