Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Preview][Memory] Reintegrate allocation callbacks mechanism #1242

Open
wants to merge 800 commits into
base: unity-main
Choose a base branch
from

Conversation

realek
Copy link

@realek realek commented Nov 20, 2019

As part of the initiative to track all of the memory going into unity, we started a bit of work to get both scripting backends to automagically allocate through the memory manager instead.

This PR is currently a preview as we spin up a custom build x branch and do performance testing to ensure we do not regress anything ^_^. I'd expect we improve allocation performance at least a bit

ashwinimurt and others added 30 commits December 5, 2018 11:13
…tion

Add option to use stevedore or ono for external build deps
In the `XmlSerializationReader` class, the `ReadString(string, bool)`
overload was not implemented in the Mono class library implementation used
for the unityaot profile. The implementation used for the unityjit
profile from the reference source implements this method.

I've copied the implementation from the reference source code here into
the code used for the unityaot profile.
Implement a ReadString overload (case 1106236)
…on-domain-unload

Ability to continue domain unload when an exception is encountered
Allow namespace-agnostic class lookup by passing NULL namespace.
…d, so we can use barriers on both mono and il2cpp
…g sequence point until actually needed.

Brings use from ~20x slower to ~5x slower when debugger codegen is enabled vs no debugger codegen.
… per assembly table rather than in metadata binary file.

This is step towards per assembly conversion.
The Suspend debugger test was hanging intermittently on most platforms.
These seemed to occur because the codegen checks for
`g_Il2CppDebuggerCheckPointEnabled` were not getting the proper value,
and assuming the check point was not set, so the VM would not suspend.

This meant that the main thread could not be suspended when the debugger
was trying to exit, so the main thread kept looping forever, with out
allowing the debugger to exit it.
The Mono implementation of mono_runtime_try_shutdown does not actually
shut down the VM. Instead, it sets the flags to indicate the VM is
shutting down. The VM should actually shutdown in mono_runtime_quit.

In some cases, we see this code path taken when processing the
CMD_VM_EXIT command. This seems unlikely, but can happen when the code
above cannot find a suspended managed thread. If
mono_runtime_try_shutdown actually waits for managed threads to
complete, it will hang, as the main thread won't be suspended because
resume_vm is called just above mono_runtime_try_shutdown.

So for IL2CPP mono_runtime_try_shutdown doesn't do anything, but
mono_runtime_quit will actually shutdown the VM.
ashwinimurt and others added 23 commits September 25, 2019 10:22
…2987

Increase max size of localloc and localloc_imm on amd64. (mono#15374)
…r-fix-create-boxed-value

Fixing issue with debugger CREATE_BOXED_VALUE command. case 1169306.
…cise-array-scanning

Bump bdwgc submodule to fix precise array marking (case 1188407)
[Android] Fixing problem with toLanguageTag for API < 21
There is logic to ensure debugger thread is shutting down
before we continue, but thread has not actually exited. This
leaves us open to race conditions in profiler events and
thread info machinery that are cleaned up by runtime shutdown.
…ugger-shutdown-race

Wait for debugger thread to exit (case 1180399, case 1189077)
Fix case 1044454. Stopwatch on Android does not update.
…94176

Avoid caching of System.dll image and types as they may be unloaded w…
…s in the background or the device is asleep."

This reverts commit d496518.
…mono-dynamic-vcxproj

Fix vcxproj by removing non-existent file.
@realek realek self-assigned this Nov 20, 2019
@unity-cla-assistant
Copy link
Collaborator

unity-cla-assistant commented Nov 20, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 10 committers have signed the CLA.

✅ ashwinimurt
✅ realek
✅ UnityAlex
❌ jechter
❌ ignas2
❌ lateralusX
❌ Josh Peterson
❌ BorisShir
❌ eneko-unity
❌ davidrogers-unity


Josh Peterson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@joncham
Copy link
Member

joncham commented Dec 4, 2019

Note, when we used the unity memory allocator previously in Mono and IL2CPP we had a noticeably larger working set; i.e. Unity memory allocator was optimized for speed not memory usage at the time.

@joncham
Copy link
Member

joncham commented Dec 4, 2019

@realek ^

@TautvydasZilys
Copy link

Yeah, and it wasn't insignificant. We had enterpise support customers complain and it had to be reverted.

@realek
Copy link
Author

realek commented Dec 5, 2019

good to know, we'll try against the new memory manager / allocator changes and see what the differences are and how we can mitigate them ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.