View Issue Details

IDProjectCategoryView StatusLast Update
0001707NoesisGUIC++ SDKpublic2020-09-24 16:38
ReporterstevehAssigned Tojsantos 
PrioritynormalSeverityfeatureReproducibilityN/A
Status assignedResolutionopen 
Product Version3.0 
Target Version3.0Fixed in Version 
Summary0001707: Feature request: Identify and notify the user about cyclic references
DescriptionHi guys,

I've recently been looking at cleaning up our shutdown code and I've fixed a few issues where a child holds a ref counted pointer to a parent object in the hierarchy. This ultimately creates a cyclic dependency between the two objects and prevents them from being cleaned up. I've attached 2 examples of code which might do this, the first is setting a DataContext to a parent object, and another is setting the TargetName on a GoToStateAction to a parent object.

It would be extremely helpful to try and detect these cases. Perhaps in debug you could assert if the TargetName or DataContext are trying to be set to a parent object in the hierarchy when you set the pointer. Or perhaps a better way is to try and find these cyclic references in shutdown if we've detected that we've leaked memory. Essentially any further information to help track these issues down would be extremely beneficial!

Cheers.
Steps To Reproduce1. Use the attached XAML files in the ApplicationLauncher Noesis sample.
2. Close the application launcher.
3. The application will leak and halt if attached in the debugger in Noesis::Shutdown

        if (GetAllocatedMemory() > 0)
        {
            NS_LOG_WARNING("Memory leaks detected: %d bytes", GetAllocatedMemory());

            #if defined(NS_DEBUG) && defined(NS_PLATFORM_WINDOWS)
                if (IsDebuggerPresent()) { NS_DEBUG_BREAK; }
            #endif
TagsNo tags attached.
PlatformAny

Relationships

related to 0001706 resolvedsfernandez Memory leak when binding DataContext to parent user control 
related to 0001798 assignedsfernandez Memory leak when using ContextMenuService.PlacementTarget 

Activities

steveh

steveh

2020-05-28 11:37

reporter  

DataContext.xaml (571 bytes)
GoToStateAction.xaml (1,489 bytes)
jsantos

jsantos

2020-06-08 14:04

manager   ~0006428

Last edited: 2020-06-08 14:05

View 3 revisions

A high-level leak detector with extra information like class name is definitely a good idea. I will try this with your scenario (cyclic dependencies when setting DataContext) to see how useful it is.

Thanks for the suggestion!

Issue History

Date Modified Username Field Change
2020-05-28 11:37 steveh New Issue
2020-05-28 11:37 steveh File Added: DataContext.xaml
2020-05-28 11:37 steveh File Added: GoToStateAction.xaml
2020-05-28 19:08 sfernandez Relationship added related to 0001706
2020-06-08 14:02 jsantos Assigned To => jsantos
2020-06-08 14:02 jsantos Status new => assigned
2020-06-08 14:04 jsantos Note Added: 0006428
2020-06-08 14:04 jsantos Target Version => 3.0
2020-06-08 14:04 jsantos Description Updated View Revisions
2020-06-08 14:04 jsantos Steps to Reproduce Updated View Revisions
2020-06-08 14:05 jsantos Note Edited: 0006428 View Revisions
2020-06-08 14:05 jsantos Note Edited: 0006428 View Revisions
2020-09-24 16:38 sfernandez Relationship added related to 0001798