blob: 46c65240b5511d69df80e2280e93ed1ea7bb28f3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#pragma once
#include "stack_common.h"
namespace NCoro::NStack {
/*! Actual size of allocated memory can exceed size in pages, due to unaligned allocation.
* @param sizeInPages : number of pages to allocate
* @param rawPtr : pointer to unaligned memory. Should be passed to free() when is not used any more.
* @param alignedPtr : pointer to beginning of first fully allocated page
* @return : true on success
*/
bool GetAlignedMemory(uint64_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept;
/*! Release mapped RSS memory.
* @param alignedPt : page-size aligned memory on which RSS memory should be freed
* @param numOfPages : number of pages to free from RSS memory
*/
void ReleaseRss(char* alignedPtr, uint64_t numOfPages) noexcept;
/*! Count pages with RSS memory
* @param alignedPtr : pointer to page-aligned memory for which calculations would be done
* @param numOfPages : number of pages to check
* @return : number of pages with RSS memory
*/
uint64_t CountMapped(char* alignedPtr, uint64_t numOfPages) noexcept;
}
|