A method for memory allocation, applied to an electronic device, wherein a memory of the electronic device comprises a first memory region and a second memory region, and the method comprises: receiving a request for memory allocation, wherein the request for memory allocation comprises a memory capacity to be allocated; comparing the memory capacity to be allocated and a capacity range of a preset memory block to obtain a comparison result; allocating a memory block with the memory capacity from at least one of the first memory region or the second memory region according to the comparison result, characterized by: adjusting a total capacity of the first memory region, comprises: detecting an available capacity of the first memory region; and adjusting the total capacity of the first memory region within a preset adjustable capacity range according to a ratio of the available capacity of the first memory region to the total capacity of the first memory region, wherein the adjusting the total capacity of the first memory region within the preset adjustable capacity range according to the ratio of the available capacity of the first memory region to the total capacity of the first memory region comprises: when the ratio is less than a first preset value, increasing the total capacity of the first memory region; when the ratio is greater than a second preset value, reducing the total capacity of the first memory region, wherein the second preset value is greater than the first preset value. receiving a request for memory allocation, wherein the request for memory allocation comprises a memory capacity to be allocated; comparing the memory capacity to be allocated and a capacity range of a preset memory block to obtain a comparison result; allocating a memory block with the memory capacity from at least one of the first memory region or the second memory region according to the comparison result, characterized by: adjusting a total capacity of the first memory region, comprises: detecting an available capacity of the first memory region; and adjusting the total capacity of the first memory region within a preset adjustable capacity range according to a ratio of the available capacity of the first memory region to the total capacity of the first memory region, wherein the adjusting the total capacity of the first memory region within the preset adjustable capacity range according to the ratio of the available capacity of the first memory region to the total capacity of the first memory region comprises: when the ratio is less than a first preset value, increasing the total capacity of the first memory region; when the ratio is greater than a second preset value, reducing the total capacity of the first memory region, wherein the second preset value is greater than the first preset value. detecting an available capacity of the first memory region; and adjusting the total capacity of the first memory region within a preset adjustable capacity range according to a ratio of the available capacity of the first memory region to the total capacity of the first memory region, wherein the adjusting the total capacity of the first memory region within the preset adjustable capacity range according to the ratio of the available capacity of the first memory region to the total capacity of the first memory region comprises: when the ratio is less than a first preset value, increasing the total capacity of the first memory region; when the ratio is greater than a second preset value, reducing the total capacity of the first memory region, wherein the second preset value is greater than the first preset value. when the ratio is less than a first preset value, increasing the total capacity of the first memory region; when the ratio is greater than a second preset value, reducing the total capacity of the first memory region, wherein the second preset value is greater than the first preset value.