Is malloc / new return memory blocking cache or RAM?

I wanted to know if malloc / new returned memory blocks from cache or RAM.

Thanks in advance.

+3
source share
7 answers

You are distracted from all this when you live as a process in the OS, you only get memory.

You do not have to worry about this, the OS will manage all this, and the memory block will move things from one to another. But you still see a single virtual memory layout.

+16
source

From virtual memory. OS will make sure to bring the necessary pages to RAM whenever the process requires it.

+5
source

malloc operator new .

. , , . , ( ) , ( ) .

+2

, . /RAM/ . , , , -. , .

0

. , , , ( , Linux). , , , , .

, , .

Java, , , , ​​, .

( , L2. L1 , , ).

0

, () ... ; ( , ), ( , ).

Read this article for more information: http://en.wikipedia.org/wiki/Memory_hierarchy

0
source

First, the memory allocated for the application is a virtual memory whose address is in virtual space. Secondly, the L1 and L2 cache will not be allocated for you, which is controlled by the system. In fact, if a cache is allocated for you, it is difficult for him to send tasks.

0
source

Source: https://habr.com/ru/post/1718455/


All Articles