Severe slowdown with Memory Protection on Unity’s GameAssembly.dll (40–60s startup; C++ calls stutter).

Issues related to VMProtect
Post Reply
STpehn
Posts: 8
Joined: Thu May 04, 2023 3:14 am

Severe slowdown with Memory Protection on Unity’s GameAssembly.dll (40–60s startup; C++ calls stutter).

Post by STpehn »

Description

#Context
@Engine: Unity 2022.3.16f1 (IL2CPP)
@Target: Windows x64, D3D11; GPU e.g. RTX 2080 Ti
@Protected binary: GameAssembly.dll
@Project layout: GameAssembly.dll links my own static lib. Inside that lib I’ve instrumented ~200 functions with VMProtectBegin.../End (mix of Mutation/Virtualization/Ultra).
@VMProtect options:
-With Memory Protection = ON → startup takes 40–60 seconds, and calling into the protected C++ frequently stutters.
-With Memory Protection = OFF (other protections ON: Import Protection, Resource Protection, etc.) → startup ≈ 3–4 seconds, runtime smooth.

#Observed behavior
-The slowdown doesn’t correlate with “code size” or “number of protected functions” alone. The decisive switch seems to be Memory Protection.
-The protected module is very large (typical IL2CPP GameAssembly.dll) and touched frequently by Unity runtime.

#My questions
-Is this performance behavior expected for very large, hot modules with Memory Protection?
-Are there official best practices to keep Memory Protection but avoid the massive slowdown on such modules?
-e.g. per-function MP only on cold paths, exclude hot code, or limit protected ranges?
-any options related to guard pages / exceptions / integrity checks that can be tuned?
-Would moving sensitive code from GameAssembly.dll into a small native DLL (only a few MB, loaded on demand) and enabling Memory Protection only there be the recommended solution?
-Any known issues or recommendations when VMP markers live in a static library that’s linked into a big DLL (like GameAssembly.dll)?
-Are there linker/optimizer settings (e.g., LTCG/LTO, inlining) that interact badly with Memory Protection on huge modules?
-Any guidance for interacting with AV/EDR (whitelisting folders/process) to avoid overhead when Memory Protection decrypts/touches pages?
-If there’s no practical way to keep Memory Protection on this big module without the slowdown, what’s the official stance: split critical logic to a small DLL + MP there, and keep the large module on Mutation/Virtualization only?

#What I’ve tried / knobs considered
-Keeping other protections ON (Import Protection, Resource Protection) while toggling MP: only MP flips the behavior.
-Reducing VM “Complexity” and instances for hot functions; still large startup hit with MP ON.

#Goal
I want to keep Memory Protection for meaningful security gains without the extreme startup/runtime cost. If the recommended path is to split into a small, strongly protected native DLL for key logic and keep GameAssembly.dll on lighter protections, please confirm that’s the right approach and share any do’s/don’ts (loading strategy, settings, pitfalls).

Thanks! :)
Last edited by STpehn on Mon Nov 17, 2025 4:05 am, edited 1 time in total.
Admin
Site Admin
Posts: 2777
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Severe slowdown with Memory Protection on Unity’s GameAssembly.dll (40–60s startup; C++ calls stutter).

Post by Admin »

Are you a registered user?
STpehn
Posts: 8
Joined: Thu May 04, 2023 3:14 am

Re: Severe slowdown with Memory Protection on Unity’s GameAssembly.dll (40–60s startup; C++ calls stutter).

Post by STpehn »

Admin wrote: Fri Nov 14, 2025 10:46 am Are you a registered user?
YES,I've bought VMProtect Ultimate for Windows - Personal License since Nov.4 2025
here is my invocie number: 38923357
Admin
Site Admin
Posts: 2777
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Severe slowdown with Memory Protection on Unity’s GameAssembly.dll (40–60s startup; C++ calls stutter).

Post by Admin »

This license belongs to a person with different email.
Admin
Site Admin
Posts: 2777
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Severe slowdown with Memory Protection on Unity’s GameAssembly.dll (40–60s startup; C++ calls stutter).

Post by Admin »

The memory protection also prevents to change attributes of memory pages for all READ_ONLY regions that belong to protected binary. Unity uses VirtualProtect for changing attributes for WRITABLE pages (don't ask me why they do that) that also belongs to the image, so it works very slow after protection.
Post Reply