The invention provides a storage space optimization method and device, a computer device and a storage medium. The method comprises: S11, generating a file storage table; S12, whether a storage instruction is received or not is judged, and if yes, the step S13 is executed; S13, obtaining unique identification information of the to-be-stored file, searching whether the unique identification information of the to-be-stored file exists in the file storage table or not, if yes, executing the step S14, and if not, executing the step S15; S14, searching whether a local storage address correspondingto the to-be-stored file exists in the file storage table or not, if yes, adding 1 to the storage frequency corresponding to the to-be-stored file in the file storage table, otherwise, storing the to-be-stored file, and setting the storage frequency corresponding to the to-be-stored file as 1 in the file storage table; and S15, storing the to-be-stored file, adding corresponding storage information of the to-be-stored file into the file storage table, and setting the storage frequency corresponding to the to-be-stored file as 1. The method and the device can solve the problem that the application program repeatedly stores the file locally.