If the application does not have enough memory accessing unmanaged resources, this could be a memory leak. Running the application in an environment with low memory directly will not help you diagnose the problem, it will happen faster.
You need to profile the memory usage of the application to determine how memory is allocated and find a leak. Conventional profiling tools will not help, because unmanaged code will not be profiled. You will need to create a memory monitoring application.
source share