View Issue Details

IDProjectCategoryView StatusLast Update
0002193NoesisGUIC++ SDKpublic2022-01-10 13:55
Reporterext.smichalak Assigned Tojsantos  
PrioritynormalSeveritytweak 
Status resolvedResolutionfixed 
Product Version3.1 
Target Version3.1Fixed in Version3.1.2 
Summary0002193: Reducing memory allocation without shutting down Noesis
Description

As we discussed in this forum thread: https://www.noesisengine.com/forums/viewtopic.php?f=3&t=2474&p=13573#p13573, we should investigate more how we could reduce the memory allocation without fully shutting down Noesis and being able to "restart" the rest of the components, dependencies, etc.

As mentioned earlier, that's the current memory allocation in our case during shutdown steps:

[code]
void Noesis::Shutdown()
{
if (gKernelState == KState::Initialized)
{
NS_LOG_INFO("Noesis Shutdown");
// Memory allocation: 2 721 711 bytes
UnregisterPackages();
// Memory allocation: 417 177 bytes
Boxing::Shutdown();
// Memory allocation: 188 512 bytes
SymbolManager::Shutdown();
// Memory allocation: 0 bytes
}
}
[/code]

The above values were tested on Windows in Unreal Editor.

We're looking into reducing that 2.7MB to as little as possible.

Steps To Reproduce

Cleaning up as much memory as possible without calling Noesis::Shutdown(). I used Noesis::GetMemoryAllocation() helper to get the above-mentioned values.

PlatformAny

Relationships

related to 0002232 assignedjsantos Use symbols with static strings in Dependency properties 

Activities

jsantos

jsantos

2021-11-17 16:35

manager   ~0007581

Thanks for this, there are many small tasks to be solved with this ticket:

  1. Have a separate macro for the inspector (now it is the same as NS_PROFILE)
  2. The inspector should consume 0 memory if it is not enabled at runtime (we don't have ways to disabled it on Unity and Unreal, only the C++ SDK)
  3. Integration API should offer a way to release all internal memory to the point after the invocation of Init
  4. Analyze memory consumed by the reflection, it seems it is more than expected and find a way to free it as much as possible before shutdown.
jsantos

jsantos

2021-12-15 21:21

manager   ~0007678

Last edited: 2021-12-17 21:16

A few improvements added in r11039.

These are the number I have right now (important you should at least measure this invoking UI::DisableInspector before UI::Init(), but in general you shouldn't release apps in profile configuration).

Uninstalling everything from IntegrationAPI (removing providers, removing resource dictionary), before UI::Shutdown() we have:
[pre]
= 1.054.854 bytes =
[/pre]

This memory mostly belongs to
[pre]
= Boxing 51 Kb =
= Symbols 184 Kb =
= Factory 34 Kb =
= Reflection 761 Kb =
[/pre]

Reflection + Symbols cannot be unloaded, at least without heavy modifications that we cannot apply on 3.1.

Boxing and Factory could be unloaded, but probably not in 3.1 because I think we need a better API for Init and Shutdown
Symbols could be optimized in general to take half that memory (we need to improve our reflection macros for Dependency Properties in C++)
Reflection can be optimized also, and we are working on it, but this is not happening soon as it is a huge breaking change.

ext.smichalak

ext.smichalak

2021-12-17 21:14

reporter   ~0007685

Thank you @jsantos for the work and thorough answer. Feel free to close this ticket, once we're able to get back to that topic and something is unclear, we're going to let you know. Thanks again!

jsantos

jsantos

2022-01-10 13:54

manager   ~0007719

Last edited: 2022-01-10 13:55

Closing this and leaving 0002232 as related

Thank you for your feedback!

Issue History

Date Modified Username Field Change
2021-11-17 13:16 ext.smichalak New Issue
2021-11-17 13:32 jsantos Target Version => 3.1.2
2021-11-17 16:31 jsantos Assigned To => jsantos
2021-11-17 16:31 jsantos Status new => assigned
2021-11-17 16:35 jsantos Note Added: 0007581
2021-12-15 21:14 jsantos Target Version 3.1.2 => 3.1
2021-12-15 21:21 jsantos Note Added: 0007678
2021-12-15 21:21 jsantos Note Edited: 0007678
2021-12-17 21:14 ext.smichalak Note Added: 0007685
2021-12-17 21:16 jsantos Note Edited: 0007678
2022-01-10 13:53 jsantos Relationship added related to 0002232
2022-01-10 13:54 jsantos Status assigned => resolved
2022-01-10 13:54 jsantos Resolution open => fixed
2022-01-10 13:54 jsantos Note Added: 0007719
2022-01-10 13:54 jsantos Fixed in Version => 3.1.2
2022-01-10 13:55 jsantos Note Edited: 0007719