Answer the question
In order to leave comments, you need to log in
Can the memory pool be smaller than the page size?
As I understand it, in order to avoid constant memory allocation, you can allocate memory in a large chunk, this is called the memory pool. Also, the page size seems to be fixed - 4KB. Can the memory pool be less than the page size or not a multiple of it?
Answer the question
In order to leave comments, you need to log in
It all depends on what you mean by the word "separate", to separate from whom to whom? The operating system allocates memory to an application page by page. At the application level for memory management, as a rule, dynamic memory is organized in the form of a heap . Accordingly, memory for the heap is allocated page by page, and from the heap - any size. The memory pool can also be organized on top of the heap, for example, if you create a hash table, you can take memory page by page from the OS (VirtualAlloc / mmap), or you can take it from the heap (new, malloc, HeapAlloc, etc).
PS Page size can be different, but fixed. Now many systems support huge pages, where one page can take up a fairly large chunk of memory, such as 2MB or 1GB. But this must be used with great care, because. paging on such pages is a very slow operation.
PPS As an alternative to the memory pool, you can use heap organization on bitmaps with fixed chunk sizes, in fact, this is about the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question