Finding memory leaks in DirectX program - memory-leaks

Background:
I have a Visual Studio 2013 project, involving DirectX (version 9). The project is an x86 solution. When running it in DirectX debug mode, I can't get rid of all the memory leaks.
Output from Visual Studio debug:
Direct3D9: :====> ENTER: DLLMAIN(6417d9a0): Process Detach 0000350c, tid=0000363c
Direct3D9: (INFO) :MemFini!
Direct3D9: (ERROR) :Memory still allocated! Alloc count = 975
Direct3D9: (ERROR) :Current Process (pid) = 0000350c
<Solution name> has triggered a breakpoint.
The program '[13580] <Solution name>' has exited with code 0 (0x0).
From the above I learned that the program has finished with 975 items still allocated and not destroyed or released. That it has triggered a breakpoint is due the setting in DirectX debug ("Break on emory leak").
So before posting actual code, I tried to use the PIX utility Microsoft ships with DirectX. By capturing the same solution I got the result below, which indicates that every object created, has also been destroyed.
Screen shot from PIX showing objects
So, I am left with a memory leak according to VS2013 but not according to PIX. Any ideas on how to proceed?

Related

Memory Leak detection in Lazarus - again

I am using Lazarus 2.0.4 on Windows 10.
Trying to track memory leaks in a quite large project I tried to familiarize myself with the heaptrc and lineinfo units/compiler switches -gh and -gl.
While this gives me some information that there is a leak somewhere, I could not figure out how to pinpoint the exact location. I put together this quite basic leaking code which will leak 4 bytes every time the button is pressed. Upon exit of the program I get this:
While from the trace I see that there is a 4 byte memory leak, I cannot see any useful reference where to look for the leaking code. I see that the code was within the click handler of a TButton, but this isn't very useful, since there may be many Buttons.
Any way to get a reference to the exact location (line 42)?

What is the purpose of 'Captures' tab in Android Studio 2.3.3?

I had noted a new tab 'Captures' on the left side of the Android Studio 2.3.3.
For me it is seem to be empty.
What is Captures meant for?
Please refer the documentation explaining on Captures in Android Studio.
When you're monitoring memory usage in the Memory Monitor included in Android Monitor you can, at the same time, dump a snapshot of the Java heap to an Android-specific Heap/CPU Profiling (HPROF) file. The HPROF Viewer displays classes, instances of each class, and a reference tree to help you track memory usage and find memory leaks. HPROF is a binary heap dump format originally supported by J2SE.
After you do a heap dump, Android Studio automatically stores it so you can view it again. "Captures" is where you see these saved HPROF dumps.
You can also see captured view layout etc there as well.
There isn't an answer to this in the built-in help. However, according to the release notes from 2015, it is a "view which shows the various performance data files you've collected".
You can learn more about Captures in the documentation about HPROF.

Crash in ID3DXConstantTable SetFloat/SetVector

We have a application with a render engine developed in Direct3d/C++. Recently we have come across a crash( access violation) involving ID3DXConstantTable SetFloat/SetVector and shows inside D3dx9_42.dll when we attached a debugger in release binaries with PDBs. One of the ways this crash vanishes when we reduce the number of D3dPOOL Rendertarget textures which are used but from estimating the GPU memory load its no where close to even half of the total available as we are using 3GB NVIDIA cards.
Suspected it to be some heap corruptions due to memory overwrites we went about code checking and following that we used the Application Verifier along with a debugger to root out of memory overwrites which might crash at a later stage of running.. We came across few issues which we ironed out. But still that crash remains at the very first frame render ID3DXConstantTable SetFloat/SetVector . More info :This is 32 bit application running with LARGEADDRESSAWARE flag. Any pointers ?
Well a moment later only i found out the issue I executed the application with the registry switch MEM_TOP_DOWN(AllocationPreference=0x100000) and it instantly crashed at the first setfloat() location.Then goto to know the constant table had to be retrieved using D3DXGetShaderConstantTableEx() with the D3DXCONSTTABLE_LARGEADDRESSAWARE flag :) Thanks

Memory profiling on Visual studio 2012 PRF0025 error

I implemented big program to find nearest neighbor using kd-Tree. But when I test it, used memory is bigger and bigger. I tried this advice, bud still not working. (No data collected when profiling .NET class library with Visual Studio 2012)
output of profiler:
Profiling started.
Warning VSP2355: Some Windows counters will not be collected. Without this data, some performance rules may not fire.
Profiling process ID 10112 (KdTreeNN).
Process ID 10112 has exited.
Data written to C:\<path>\KdTreeNN\KdTreeNN140529.vsp.
Profiling finished.
PRF0025: No data was collected.
Profiling complete.
Some other advices? Please help. Thanks

CUDA device seems to be blocked

I'm running a small CUDA application: the QuickSort benchmark algorithm (see here). I have a dual system with a NVIDIA 660GTX (device 0) and 8600GTS (device 1).
Under Windows 8 and Visual Studio, the application compiles and runs flawlessly on device 0. Under Linux (Ubuntu 12.04 LTS), the app compiles with nvcc and gcc but suddenly stops in its tracks, returning a (unspecified launch failure).
I have two issues:
After this error, my GPU cannot perform some other operations, e.g., running the SDK example bandwidhtTest blocks when it performs the first data transfer, but running deviceQuery continues to perform well. How can I reset my GPU? I've already tried the cudaDeviceReset() method but it doesn't help
How can I find what is going wrong under linux? Has someone a clue or seen this before?
Thanks in advance for your help!
Using the nvidia-smi utility you can reset the GPU if it is compatible
To my knowledge and experience, (unspecified launch failure) usually referees to segmentation fault. Have you specified the right GPU to use? Try to use cuda-memcheck to see if there is any memory out of bound scenario.
From my experience XID 31 was always caused by accessing bad pointer (aka Memory access violation).
I'd first pursue this trail. Run your application with cuda memcheck. Like that cuda-memcheck you_app args to your app and see if it finds any wrong memory accesses.
Also try stepping though the code with cuda-gdb or Nsight Eclipse Edition.
I've found that using
cuda-memcheck -b ...
prevents the device from locking up.

Resources