Generating Memgraph with leaks tool in a UI test does not generate backtraces.

I have an XCUITest and in the course of the test, in tearDown for eg. I call the leaks tool on the application and generate a memgraph.


% leaks App_Name --outputGraph=~/Desktop/Foo.memgraph


Before launching the application, I set MallocStackLogging so that the backtraces are present.


XCUIApplication *app = [[XCUIApplication alloc] init];  
NSMutableDictionary *launEnv = [app.launchEnvironment mutableCopy];
[launEnv setObject:@"1" forKey:@"MallocStackLoggingNoCompact"];
app.launchEnvironment = launEnv;

If I pause the application process in the course of the test, and open the Memory Graph Debugger, the entire call trace is present for a leak.
On calling the above command, the leaks file is found to contain the call trace however the memgraph only contains

0 malloc_zone_calloc
49 _main_thread

for all objects. Also, calling the leaks command provides the following output:


Invalid connection: com.apple.coresymbolicationd
Region __TEXT __objc_methname [7fff2731d13e -> 1b43) outside of relocations in mmap SOD
Region __TEXT __objc_methname [7fff2731d13e -> 1b43) outside of relocations in mmap SOD
Region __TEXT __objc_methname [7fff2731d13e -> 1b43) outside of relocations in mmap SOD
Region __TEXT __objc_classname [7fff23e244b0 -> 11f8) outside of relocations in mmap SOD
Region __TEXT __objc_classname [7fff258aabe4 -> 5175) outside of relocations in mmap SOD
Region __TEXT __objc_classname [7fff47c7c5e4 -> 20970) outside of relocations in mmap SOD
Region __TEXT __objc_classname [7fff209eb2f4 -> 4f9f) outside of relocations in mmap SOD
etc.

Replies

You can also do this in the scheme. In your app's scheme, enable Malloc Stack logging for Live Allocations. This is under Diagnostics.


Make sure to enable this in the approprate operation, Run or Test.