The relationship between dwPageSize and dwAllocationGranularity

Im reading the source code of Googles TCMalloc (porting Windows).

int getpagesize() 
{
    static int pagesize = 0;
    if (pagesize == 0) 
    {
      SYSTEM_INFO system_info;
      GetSystemInfo(&system_info);
      pagesize = std::max(system_info.dwPageSize, system_info.dwAllocationGranularity);
    }
    return pagesize;
 }

As you can find the code snippet above pagesize(which is the distribution unit) is calculated as max between dwPageSize and dwAllocationGranularity. What I want to know is the kind of relationship between these two values: is it necessary to calculate the value in the sense as it opens up here? Are there situations in which dwPageSize may be larger than dwAllocationGranularity?

+4
source share
1 answer

: - , .

, . , .

:

  • , . , .

  • . , / , .

, . , , ( ) () .

+2

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


All Articles