Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between reserved and committed memory?

I understand that memory has to be reserved before being committed. And when it's reserved, no other process can use it. However reserved memory does not count against available RAM. But shouldn't it? Because if no one else can use it, then what good is it being "available"?

Or is there some bigger difference?

like image 721
glutz78 Avatar asked Mar 13 '10 23:03

glutz78


People also ask

What is reserved memory?

What Does Reserved Memory Mean? Reserved memory describes storage space that's set aside by a technology for its use. The idea is that memory reserved for a specific process cannot be used by other processes.

What does memory committed mean?

Formally committed memory is the memory that is backed either by physical memory or in the page file because it is being used. This represents the actual memory being used and is ultimately limited by physical memory and page file size.

What is committed memory in SQL Server?

You are correct committed memory is physical memory used because committed memory is backed by physical memory while reserved memory is memory reserved by process which it thinks it might need it may necessarily not be committed.

Why is committed memory higher than RAM?

3 Answers. Show activity on this post. "Why is my “Committed” memory so much higher than my actual RAM space?" Because "committed" is mostly process-private virtual address space, and some of this can be in RAM and some in the pagefile. And some might not occupy any storage at all!


2 Answers

In the context of Win32, "reserved" means that the address space is allocated within the process that requested it. This may be used, for example, to reserve space for a large buffer that's not all needed right away, but when it's needed it would need to be contiguous.

Reserving memory does not interact with other processes at all, since each process has its own private address space. So the statement that "when it's reserved, no other process can use it" is meaningless, since processes can't normally allocate memory in the address space of another process anyway.

When the reserved pages are requested to be committed (backing store allocated for them), that operation can potentially fail due to lack of physical memory (or pagefile).

like image 180
Greg Hewgill Avatar answered Sep 23 '22 18:09

Greg Hewgill


I like to view Reserved as booking the address space so that no one else can allocate it (but I can't use memory at that address because it is not yet available). And Committed as mapping that address space to the physical memory so that it can be used.

Why would I want to reserve? Why not just get committed memory? There are several reasons I have in mind:

  1. Some application needs a specific address range, say from 0x400000 to 0x600000, but does not need the memory for storing anything. It is used to trap memory access. E.g., if some code accesses such area, it will be caught. (Useful for some reason.)

  2. Some thread needs to store progressively expanding data. And the data needs to be in one contiguous chunk of memory. It is preferred not to commit large physical memory at one go because it is not needed and would be such a waste. The memory can be utilized by some other threads first. The physical memory is committed only on demand.

like image 39
kaosad Avatar answered Sep 20 '22 18:09

kaosad