A method for allocating memory resources, the method being applied to a terminal device, the terminal device comprising a rich execution environment, REE, and a fingerprint trust application, TA,, the method comprising: obtaining, by the REE, from a memory space N values of memory resources requested at N time points within a preset period by the fingerprint TA, based on that the REE receives a request for memory resources from the fingerprint TA, wherein the request for memory resources carries an identifier of an application K that needs to occupy memory resources, and each of the N values of memory resources is in one-to-one correspondence with one of the N time points and N represents an integer larger than 1; determining, by the REE, a target value of memory resources according to the N values of memory resources; and allocating, by the REE, memory resources equal in value to the target value of memory resources for the fingerprint TA; wherein determining, by the REE, the target value of memory resources according to the N values of memory resources comprises: determining, by the REE, W values of memory resources, wherein the W values of memory resources are normal values among the N values of memory resources; determining, by the REE, an average value of memory resources according to the W values of memory resources; and when a priority of the application K is higher than or equal to a preset priority and the average value of memory resources is smaller than a preset value, determining, by the REE, the preset value as the target value of memory resources, or when the priority of the application K is lower than the preset priority and the average value of memory resources is smaller than the preset value, determining, by the REE, the average value of memory resources as the target value of memory resources. obtaining, by the REE, from a memory space N values of memory resources requested at N time points within a preset period by the fingerprint TA, based on that the REE receives a request for memory resources from the fingerprint TA, wherein the request for memory resources carries an identifier of an application K that needs to occupy memory resources, and each of the N values of memory resources is in one-to-one correspondence with one of the N time points and N represents an integer larger than 1; determining, by the REE, a target value of memory resources according to the N values of memory resources; and allocating, by the REE, memory resources equal in value to the target value of memory resources for the fingerprint TA; wherein determining, by the REE, the target value of memory resources according to the N values of memory resources comprises: determining, by the REE, W values of memory resources, wherein the W values of memory resources are normal values among the N values of memory resources; determining, by the REE, an average value of memory resources according to the W values of memory resources; and when a priority of the application K is higher than or equal to a preset priority and the average value of memory resources is smaller than a preset value, determining, by the REE, the preset value as the target value of memory resources, or when the priority of the application K is lower than the preset priority and the average value of memory resources is smaller than the preset value, determining, by the REE, the average value of memory resources as the target value of memory resources. determining, by the REE, W values of memory resources, wherein the W values of memory resources are normal values among the N values of memory resources; determining, by the REE, an average value of memory resources according to the W values of memory resources; and when a priority of the application K is higher than or equal to a preset priority and the average value of memory resources is smaller than a preset value, determining, by the REE, the preset value as the target value of memory resources, or when the priority of the application K is lower than the preset priority and the average value of memory resources is smaller than the preset value, determining, by the REE, the average value of memory resources as the target value of memory resources.