Direct2D Debug - An interface [x] was created but not released - directx

I have the Direct2D debug layer turned on. When my application exits, I get the following output:
D2D DEBUG ERROR - An interface [x] was created but not released. Use 'dps x' to view its allocation stack.
Where x is an address.
What is dps and how can I discover what interface is not being released, and view its allocation stack?
Thanks.

Related

Xcode memory tools disagree on presence of Zombie Objects

My app seems to have a memory problem. I'm not getting any crashing, but when testing on device, both Instruments and the Debug Navigator agree that the amount of memory my app is using keeps increasing depending on what I'm doing in the app.
So, I tried to diagnose the problem.
First, I thought about normal memory leaks -- and there were many. So, after a lot of work with the Instruments -> Leaks template, I was able to eliminate them.
But the memory problem persisted.
So, I decided to look for zombie objects. First, I enabled zombies in Xcode. Because I was unsure whether I needed to enable zombies for "Run" or "Test" or both, I did both. So, that's Edit Scheme -> Run -> Diagnostics -> Zombie Objects and Edit Scheme -> Test -> Diagnostics -> Zombie Objects.
I was also unsure whether to run Instruments through a debug or release build configuration, so I tried it with both (with the same outcome).
Here's a screenshot showing the location of the Debug Navigator:
Here's a screenshot of the memory options I enabled prior to using View Memory Graph Hierarchy:
Now that zombies are enabled, I go to Debug Navigator -> View Memory Graph Hierarchy, and Xcode builds a memory graph that says my app has something like a thousand zombie objects. There are zombies of all kinds -- everything from SceneKit stuff to CloudKit and GameplayKit stuff.
Here's a screenshot of some of those zombie objects:
So, I decided to investigate further using Instruments.
Here's what Apple says on using Instruments to detect zombies:
"If a call is made to a deallocated object, a flag is inserted in the
timeline pane and a Zombie Messaged dialog appears, indicating that a
message was sent to a deallocated object at a specific memory
address."
However, if I open Instruments and use the Zombies template, I never see any such flags/dialogs.
Here's a screenshot showing what I see after running the Instruments Zombies template (notice the lack of flags/dialogs):
Question: Why might the memory graph hierarchy tool and Instruments disagree so markedly on the presence of zombies? Is there some further Xcode configuration I'm missing or something? How should I proceed?
Thanks!

'Incorrect Type of Metal Texture' - Fixed by Disabling Metal API Validation. Why?

I am loading a 3D object into ARKit on a MTLDevice with textures programmatically (.dae + .jpg) and it has transparency. However, when I set the objectNode.transparency property to anything other than 1.0 (the default float value), then I receive the following error and the app crashes: Function(commonprofile_frag): incorrect type of texture (MTLTextureTypeCubeArray) bound at texture binding at index 7 (expect MTLTextureTypeCube) for u_radianceTexture[0].' I have looked at Apple's documentation and developer blog and it seemed to be an error from an earlier Xcode version - however I am running the latest full release - 10.1 (10B61).
It turns out I actually solved this by popping into the Product>Scheme>EditScheme>Options tab and disabling "Metal API Validation". Everything seems to be working properly as of now... does this expose to scrutiny from Apple and/or possible errors? Why did this work as a solution?

Xcode debugging (breakpoint) issue

I'm writing an iOS app in Objective-C for iOS 8.4 with Xcode 6.4. I have a variable (actually an item in an array) changing in unexpected ways.
In order to find out what is going on, I would like to have a way to make the program pause when a change on the variable is about to happen (or just happened), using some kind of “special break point”.
Is this possible, if YES how?
What you want is a Watchpoint (see "Setting Watchpoints" here).
Basically they monitor memory for writes and break the program when that happens.
I think you can only set them from the debugging console, not the Xcode UI, with:
(lldb) watchpoint set variable myinstancevar
or
(lldb) w s v myinstancevar

Nvwa leak detection library crashes on iOS

Nvwa crashes on free calls in its delete operator overrides, especially on simulator, with error:
malloc: *** error for object [hexadecimal address]: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Your leak detection library apparently and ironically has a heap corruption bug, likely use-after-free. I suggest you use Instruments or malloc history to determine what that address previously corresponded to and then audit the lifecycle of that allocation and pointers to it.
It's all about compilation settings on the target that you use to build the library.Nvwa uses platform-specific macros to recognise available threading libraries and it so happens that _PTHREADS is not normally defined on iOS and I did not allow C++11 mutexes by NOT defining NVWA_USE_CXX11_MUTEX set to 1. So we have few alternatives, either define _PTHREADS, allow use of C++11 mutexes or change Nvwa code to also check for _POSIX_THREADS macro... One of the places that absolutely require "proper" mutexes is the update of allocation list that is used to report leaks (in debug_new.cpp). Without synchronising there, next element pointers are bound to eventually point to released memory and use-after-free is just a matter of time.

gdb call to malloc fails (iOS)

I'm using gdb (release 1708 from radare.org) on iOS 6.0.1 to debug an unknown app. For some reason I want to allocate memory, which should work via "call (char*)malloc(size)". I already browsed a lot of samples using such calls (for instance here) but all of these calls fail.
(gdb) call (char*)malloc(4)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000004
0x37af2060 in strcpy ()
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context to what it was before the call.
To change this behavior use "set unwindonsignal off"
Evaluation of the expression containing the function (malloc) will be abandoned.
or
(gdb) print (float) fabs (3.0)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x40080000
0x37b18040 in T_CString_int64ToString ()
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (T_CString_int64ToString) will be abandoned.
Why would malloc access memory at the parameter "size"? Anly ideas how to fix this? Or is the gdb version simply not ready for iOS 6.X? The actual call seems to work, but internal Functions cause the failure (T_CString_int64ToString).
It appears that GDB is attempting to access an unmapped memory region, which is the address returned by the malloc call. Try attaching to a known application/process and see if the malloc call works.
Have you tried release 1821?
it's available from CrackLords Repository, add it to cydia to get this version
or alternatively you can follow these instructions to sign it yourself A working GNU Debugger on iOS >= 4.3

Resources