A method for managing a memory of a virtual machine, wherein the virtual machine runs on a physical host, the physical host is connected to a Peripheral Component Interconnect Express, PCIE device, the PCIE device is a hardware device that supports the single-root I/O virtualization, SR-IOV standard, and the PCIE device has at least one physical function, PF and at least one virtual function, VF, wherein a unique function number is configured for each PF and each VF separately; wherein the virtual machine executes a service by using a VF in the at least one VF, and the virtual machine corresponds to a function number of the VF in the at least one VF; and the method comprises: allocating, by the virtual machine, a memory to at least one service carried on the PCIE device, wherein the memory allocated to each service comprises multiple memory blocks, each of the multiple memory blocks is used to save working information of a corresponding service, and each memory block is a section of memory space in which guest physical addresses are consecutive; generating, by the virtual machine, a base address table, BAT and a chip logic address table, CLAT according to the memory allocated to each service, wherein the BAT comprises a CLAT entry base address corresponding to each service, and the CLAT comprises a first address of each memory block; sending, by the virtual machine, an address of the BAT and a function number corresponding to the virtual machine to the PCIE device, wherein a correspondence between the address of the BAT and the function number corresponding to the virtual machine is saved into a virtual machine configuration table, VCT of the PCIE device connected to the physical host; wherein when the virtual machine is migrated from the physical host to a destination physical host, the memory blocks, the BAT, and the CLAT are migrated to the migrated virtual machine on the destination physical host; and wherein after the migration, a correspondence between the address of the BAT and a function number which corresponds to the migrated virtual machine and is of a VF in a PCIE device connected to the destination physical host, is configured into a VCT in the PCIE device connected to the destination physical host. allocating, by the virtual machine, a memory to at least one service carried on the PCIE device, wherein the memory allocated to each service comprises multiple memory blocks, each of the multiple memory blocks is used to save working information of a corresponding service, and each memory block is a section of memory space in which guest physical addresses are consecutive; generating, by the virtual machine, a base address table, BAT and a chip logic address table, CLAT according to the memory allocated to each service, wherein the BAT comprises a CLAT entry base address corresponding to each service, and the CLAT comprises a first address of each memory block; sending, by the virtual machine, an address of the BAT and a function number corresponding to the virtual machine to the PCIE device, wherein a correspondence between the address of the BAT and the function number corresponding to the virtual machine is saved into a virtual machine configuration table, VCT of the PCIE device connected to the physical host; wherein when the virtual machine is migrated from the physical host to a destination physical host, the memory blocks, the BAT, and the CLAT are migrated to the migrated virtual machine on the destination physical host; and wherein after the migration, a correspondence between the address of the BAT and a function number which corresponds to the migrated virtual machine and is of a VF in a PCIE device connected to the destination physical host, is configured into a VCT in the PCIE device connected to the destination physical host.