// Calculate the total memory chunks of the segment static void decideTotalChunks(int32 *totalChunks, int32 *chunkSizeInBits) { …… nsegments = Gp_role == GP_ROLE_EXECUTE ? host_segments : pResGroupControl->segmentsOnMaster; // ResGroupOps_GetTotalMemory获得系统可用内存: // RAM * overcommit_ratio + Swap tmptotalChunks = ResGroupOps_GetTotalMemory() * gp_resource_group_memory_limit / nsegments; /* If vmem is larger than 16GB (i.e., 16K MB), we make the chunks bigger * so that the vmem limit in chunks unit is not larger than 16K.*/ tmpchunkSizeInBits = BITS_IN_MB; while(tmptotalChunks > (16 * 1024)) { tmpchunkSizeInBits++; tmptotalChunks >>= 1; } …… }