What will happen if we didn't release Direct2D objects?

thebluetropics 1,046 Reputation points
2022-09-14T07:30:56.99+00:00

There are several device-dependent and device-independent resources in my Direct2D application.

I wonder, what if I didnt Release() them after the application exists? What will happen is likely a memory leak. Does window handles that automatically? Or we must release in order to free hardware memory?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,578 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,683 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 84,281 Reputation points
    2022-09-14T08:12:27.393+00:00

    All process resources are released when a process is terminated

    There is In M. Russinovich book, Windows Internals :

    In whatever way a process ceases to exist, there can never be any leaks. That is, all process’s private
    memory is freed automatically by the kernel, the address space is destroyed, all handles to kernel
    objects are closed, etc. If open handles to the process still exist (the EPROCESS structure still exists), then
    other processes can still gain access to some process-management information, such as the process
    exit code (GetExitCodeProcess). Once these handles are closed, the EPROCESS is properly destroyed,
    and there’s truly nothing left of the process.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.