Nop Fel666.
The ram needs active eletricity to store data.
when you power off or restart your pc the memory it's released without OS intervention.
but it's not the same that the aplication takes a lot of ram (ejample: "MINECRAFT")
or having a aplication take ram away from you until you restart your PC (called: memory leak)
in the programs that run into a virtual machine that's not a problem, because they have garbage collector.
but in C, you can actually take the memory until you power off the ram, if you dont handle it correctly.
Even when writing in C, the OS has got your back.
When allocating memory, you are not actually interfacing directly with the hardware. You are asking the OS to allocate memory.
The oS interfaces with the hardware and allocated memory. What it returns to the software is a virtual address space.
This means that programs are isolated from each other (a pointer in one program can have the same value as a pointer in another program without them being the same physical adress).
The os keeps track of what memory is allocated to what process, and when the process ends, it marks the memory as free, ready to be reused by another process (it may even clear the memory for security, but not necessarily).
You can easily test this yourself:
Create a C program that calls calloc continually. When it reaches 2 GB of mem usage or so, kill it, and obsrve your ram usage.