A memory allocation method and a server, wherein the method includes: identifying, by a server, a node topology table; generating fetch hop tables of the NUMA nodes based on the node topology table; calculating fetch priorities of the NUMA nodes based on the fetch hop tables of the NUMA nodes, and using an NC hop count as an important parameter for fetch priority calculation; and when a NUMA node applies for memory, allocating memory based on the fetch priority table, and for a higher priority, more preferentially allocating memory from a NUMA node corresponding to the priority.
展开▼