Method, storage medium, electronic device and system for automatically releasing file resources
An automatic release and file resource technology, applied in resource allocation, program control design, electrical digital data processing, etc., can solve problems such as system exceptions, memory bank leaks, and reduction of available memory space, and achieve the effect of solving memory leaks
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0042] figure 1 It is a schematic diagram of the steps of the method for automatically releasing file resources in the embodiment of the present invention.
[0043] Such as figure 1 As shown, the method for automatically releasing file resources includes the following steps S1 to S5.
[0044] Step S1, setting a file read and write function to perform read and write operations on the file, the read and write function is set as a public type and has a parameter of a file path.
[0045] This step mainly realizes the design and definition of file read and write functions.
[0046] File reading and writing usually involves two aspects of information: the file path filePath, the length information length of the file to be read, and so on.
[0047] Based on the above-mentioned file read and write information, this embodiment designs a file read and write function readFile, and the specific function definition is as follows:
[0048] public static String readFile(String filePath, ...
Embodiment 2
[0101] An electronic device provided by this embodiment will be described in detail below.
[0102] The electronic device includes a memory and a processor, and the memory stores a computer program running on the processor, and is characterized in that: the method for implementing the following steps when the processor executes the computer program:
[0103] Step S1, setting a file read and write function to perform read and write operations on the file, the read and write function is set as a public type and has a parameter of a file path.
[0104] Step S2, verifying the read-write function according to the file path.
[0105] Step S3, after the verification is passed, sub-threads are created to perform read and write operations.
[0106] Step S4, closing the file stream resource information of the file object read in the read-write operation and releasing the memory resource occupied by the file object.
[0107] In step S5, communication is established between the main thr...
Embodiment 3
[0118] The storage medium provided in this example will be described in detail below.
[0119] A storage medium, on which a computer program is stored, is characterized in that: when the computer program is executed by a processor, the method for realizing the following steps is realized:
[0120] Step S1, setting a file read and write function to perform read and write operations on the file, the read and write function is set as a public type and has a parameter of a file path.
[0121] Step S2, verifying the read-write function according to the file path.
[0122] Step S3, after the verification is passed, sub-threads are created to perform read and write operations.
[0123] Step S4, closing the file stream resource information of the file object read in the read-write operation and releasing the memory resource occupied by the file object.
[0124] In step S5, communication is established between the main thread and the sub-thread to obtain the file content information ...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com