KR20160122618A - Method and apparatus for recovering leakage of nonvolatile memory - Google Patents
Method and apparatus for recovering leakage of nonvolatile memory Download PDFInfo
- Publication number
- KR20160122618A KR20160122618A KR1020150095967A KR20150095967A KR20160122618A KR 20160122618 A KR20160122618 A KR 20160122618A KR 1020150095967 A KR1020150095967 A KR 1020150095967A KR 20150095967 A KR20150095967 A KR 20150095967A KR 20160122618 A KR20160122618 A KR 20160122618A
- Authority
- KR
- South Korea
- Prior art keywords
- node
- identification information
- area
- data structure
- releasing
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0253—Garbage collection, i.e. reclamation of unreferenced memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/20—Employing a main memory using a specific memory technology
- G06F2212/202—Non-volatile memory
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
A method for judging and recovering leakage from a nonvolatile memory is presented. A method for restoring a nonvolatile memory includes the steps of determining whether a node is accessible from a parent node to a child node in a data structure to which a plurality of nodes are connected, generating identification information indicating whether the node is accessible for each node of the data structure And releasing the area of the non-volatile memory allocated to the node corresponding to the pointer disconnected in the data structure according to the identification information.
Description
BACKGROUND OF THE
In an operating system that uses volatile memory, memory leaks can be avoided because all memory is automatically returned when the process terminates, even if user-allocated memory is not freed.
However, in an operating system that uses nonvolatile memory, the allocated memory is maintained regardless of the termination of the process. Therefore, the user must explicitly deallocate the area. If the nonvolatile memory is abnormally terminated and can not be deallocated, the area may become an inaccessible area.
If a pointer to a data structure of a dynamically allocated memory is missing due to a user's fault or a sudden power failure, an inaccessible memory is generated. If you try to deallocate the area, you will not be able to release it because the address is unknown. If inaccessible memory is accumulated, there is a problem that the memory that can be allocated by the operating system gradually decreases.
It is possible to provide a method for preventing leakage of the nonvolatile memory by displaying identification information indicating whether or not each node of the data structure is accessible and releasing allocation of the inaccessible area according to the identification information.
According to an embodiment, there is provided a method of preventing memory leakage, the method comprising: determining whether a node is accessible from a parent node to a child node in a data structure to which a plurality of nodes are connected; And releasing the area of the non-volatile memory allocated to the node corresponding to the pointer that is disconnected in the data structure according to the identification information.
Wherein the step of releasing the area of the non-volatile memory allocated to the node comprises: releasing the area of the non-volatile memory allocated to the node based on metadata including the address of the allocated area corresponding to the node and the size of the allocated area have.
Wherein the step of determining whether or not the accessibility is possible includes a step of initializing the identification information, and the step of generating the identification information determines whether or not the initialized identification information is changed according to the accessibility .
Wherein the step of determining whether to change the identification information includes a step of changing the corresponding identification information when the node is accessible, and the step of releasing the area of the non-volatile memory includes a step And releasing the area of the corresponding non-volatile memory if not.
Wherein the step of determining whether to change the identification information includes changing the corresponding identification information when the node is inaccessible, wherein the step of releasing the area of the non-volatile memory comprises: And releasing the area of the corresponding non-volatile memory.
The memory leak prevention method may further include the step of initializing the identification information corresponding to the accessible node after the step of releasing the area of the non-volatile memory.
According to an embodiment, there is provided a memory leak prevention apparatus comprising: a determination unit for determining whether a node can be accessed from a parent node to a child node in a data structure to which a plurality of nodes are connected; And a releasing unit for releasing the area of the nonvolatile memory allocated to the node corresponding to the pointer disconnected in the data structure according to the identification information.
It is possible to prevent leakage of the nonvolatile memory by displaying the identification information indicating whether or not access is possible for each node of the data structure and releasing the inaccessible area according to the identification information.
FIG. 1 illustrates a process of inserting a new node and an abnormal termination state of a connection type data structure according to an exemplary embodiment.
FIG. 2 shows an abnormal termination state of a tree-like data structure according to an embodiment.
FIG. 3 illustrates metadata assigned to each node according to an exemplary embodiment.
4 illustrates a method of releasing a memory region of an inaccessible node according to an embodiment.
FIG. 5 illustrates a search process of a tree-type data structure according to an embodiment.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. Like reference symbols in the drawings denote like elements.
FIG. 1 illustrates a process of inserting a new node and an abnormal termination state of a connection type data structure according to an exemplary embodiment.
Referring to FIG. 1,
If the process is not terminated abnormally, the processor must change the pointer of the head of the data structure to point to the new node at
However, if the processor is abnormally terminated, the insertion process may be interrupted before the
At this time, in the case of volatile memory, the memory is reduced even if the processor abnormally terminates. In the case of the nonvolatile memory, since the memory allocation state at the time of termination is maintained, the leakage state of the memory is also maintained. If this situation is accumulated, there will be insufficient memory to be allocated.
FIG. 2 shows an abnormal termination state of a tree-like data structure according to an embodiment. The tree type data structure is a kind of nonlinear data structure. The tree-type data structure may be a binary tree, a B-tree, or the like.
When the processor terminates abnormally in a tree structure, unlike the data structure of a connection structure, a memory leak phenomenon may occur only for a part of a child node. Tree type data structure can have multiple child nodes in one parent node. However, since the address of the allocated memory can not be retrieved, and the accumulation of such phenomenon causes the memory shortage phenomenon, the seriousness of the situation is the same. This is particularly problematic in non-volatile memory where the memory remains inaccessible.
The non-volatile memory may be a STT-MRAM (Spin Torque Transfer Magnetoresistive RAM), a FRAM (Ferroelectric RAM), a PRAM (Phase-change RAM), a RRAM (Resistive RAM), an NRAM (Nano RAM)
FIG. 3 illustrates metadata assigned to each node according to an exemplary embodiment.
A plurality of nodes of the data structure may have corresponding metadata for each node. The metadata may include identification information, the address of the allocated area, and the size of the allocated area. The identification information may be information indicating whether or not the node is accessible. The identification information may be a flag and may indicate whether or not it can be accessed by values of 1 and 0.
The identification information means that it is inaccessible when it is 0 and may be accessible when it is 1. Also, the identification information means that it is inaccessible at 1, and it can mean that it is accessible at 0.
The address of the allocated area and the size of the allocated area can be used in releasing the allocated area of non-volatile memory. If memory is allocated to a node, the physical address of the start and the size of the allocated memory represent all of the correspondence. That is, knowing only the address and the memory size, the location and capacity of the memory allocated to the node can be known.
When there is a request for dynamic memory allocation, the processor can write the address and size of the allocated area into the memory while allocating the dynamic memory.
The identification information shown in FIG. 3 indicates all zeros, which may indicate an initialized state before starting the search. This value can be changed to 1 if it is accessible as described in FIG. 5 to be described later. The address of the allocated area may represent a physical address on the non-volatile memory. The size of the allocated area may be, for example, in units of bytes.
4 illustrates a method of releasing a memory region of an inaccessible node according to an embodiment.
Step 401 may indicate initializing the identification information. The identification information may be initialized to zero. In this case, 0 can mean inaccessible state. The initialization step can be done before the search of the data structure to determine whether accessibility is possible.
Step 402 may represent determining accessibility, and step 403 may represent generating identification information. The search of the data structure can be done at the beginning of the data structure. This starting point may be the head or the root. If you follow other pointers, the point at which you can navigate through the entire data structure can be the starting point.
The search for the data structure can be done by following the address of the child node stored in the pointer of the corresponding node. As a search method, depth-first search and width-first search can be used. Any search method can be used as long as the entire node of the data structure can be searched.
The processor can search the data structure and generate identification information of the node. All the identifiers representing whether or not the node is accessible can be used as the identification information. For example, you can use 1 as a value representing an accessible state and 0 as a value representing an inaccessible state.
Step 404 may indicate the step of changing the identification information according to whether or not it is accessible. The step of generating the identification information may include the step of changing the identification information. As described above, the identification information is initialized before searching the data structure, which may mean changing the initialized identification information. At this time, if the node is accessible, the identification information can be changed and if the node is inaccessible, the identification information can be maintained. Or vice versa.
For example, if the initialization value is 0, it can be promised to change the identification information if it is accessible. Since the node to be searched along the pointer is an accessible node, the identification information can be changed to 1. A node that can not be reached along the pointer is an inaccessible node, so the identification information can be kept at zero.
Conversely, if the initialization value is 0, it can be promised to change the identification information if it is inaccessible. Since the node to be searched along the pointer is an accessible node, the identification information can be kept at zero. A node that can not reach along the pointer is an inaccessible node, so the identification information can be changed to 1.
If the metadata is stored in the area of the non-volatile memory allocated to each node, only the metadata of the node that can access along the pointer may be changeable. That is, metadata may be stored in the node itself. In this case, the metadata of the inaccessible node is stored in the area where the node is allocated, so that access to the metadata may not be possible unless there are other means. In this case, it will be changed to 1 if it is accessible, and will remain 0 if it is inaccessible.
On the other hand, you can set 1 to inaccessible state and 0 to inaccessible state. The indication of discrimination can be expressed using different values instead of 0 and 1.
Step 405 may represent releasing the memory area of the disconnected node. Step 405 may be performed after searching the entire data structure to generate identification information as described above.
The release of the nonvolatile memory area can be accomplished by following the metadata corresponding to the nodes of the data structure. If it is determined that the node is inaccessible according to the identification information, the allocation of the physical area corresponding to the allocated size can be released from the allocated physical area address. The unallocated physical area is placed in the allocation waiting state and can be allocated when an operating system, an application program, or the like requests allocation of storage space.
It is possible to use a method of inserting an inaccessible node into a free list using the address and size of the allocated area, and reallocating the memory when the operating system requires memory allocation.
If the metadata is stored in the area of the non-volatile memory allocated to each node, only the metadata of the node that can access along the pointer may be changeable. That is, metadata may be stored in the node itself. In this case, instead of searching the physical area along the node from the root of the data structure, the physical area itself can be searched sequentially or according to another efficient algorithm.
Step 406 may indicate initializing the identity of the accessible node. Accessible nodes can be easily traversed along the root of the data structure. The identification information of the metadata of the node to be searched can be initialized and prepared for the next memory leak search.
In this way, if the memory area can not be accessed for a variety of reasons (for example, the node pointer is disconnected due to a sudden power failure during the node insertion process), the area can be deallocated. Memory leaks can be prevented by collecting and releasing these inaccessible memory areas and reducing them to reuse.
FIG. 5 illustrates a search process of a tree-type data structure according to an embodiment. FIG. 5 shows each node of the tree-like data structure of FIG. 2 in correspondence with metadata. It is assumed that all identification information of the immediately preceding metadata immediately after
The search method may be depth first search. That is, if the search is performed from the left side of each node and there is no child node of the node being searched, the right child node of the parent node of the searching node can be searched. Through this search method, the entire node of the data structure can be searched completely.
Step 501 may indicate a process of searching for
Step 502 may indicate a process of searching for
Thereafter, the processor must search for the left child node according to the depth-first search conventions. However, since
Similarly, the processor can not access
Step 503 may indicate a process of searching for the
After the search is terminated, the processor can determine the identification information via the metadata. Since the preceding 0 has promised to indicate an inaccessible area, a node with
Then, the processor may initialize the identification information of the nodes determined to be accessible to zero. This allows you to prepare for the next memory leak prevention request.
Through the above-described embodiments, it is possible to prevent a memory leak occurring in a non-volatile memory and to restore a leaked memory to a state that can be reallocated.
The methods according to embodiments of the present invention may be implemented in the form of program instructions that can be executed through various computer means and recorded in a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, and the like, alone or in combination. The program instructions recorded on the medium may be those specially designed and constructed for the present invention or may be available to those skilled in the art of computer software.
While the invention has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those of ordinary skill in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. This is possible.
Therefore, the scope of the present invention should not be limited to the described embodiments, but should be determined by the equivalents of the claims, as well as the claims.
401: Initializing the identification information
402: Step of judging whether or not accessibility is possible
403: Step of generating identification information
404: Step of changing identification information according to availability
405: releasing the memory area of the disconnected node
406: initializing the identification information of the accessible node
Claims (7)
Generating identification information indicating whether the data structure is accessible for each node; And
Releasing a region of non-volatile memory allocated to a node corresponding to a pointer disconnected in the data structure according to the identification information
/ RTI >
Wherein releasing the area of the non-volatile memory allocated to the node comprises:
Based on metadata including the address of the allocated area corresponding to the node and the size of the allocated area.
Further comprising the step of initializing the identification information prior to the step of determining whether or not the access is possible,
Wherein the step of generating the identification information comprises determining whether the initialized identification information is changed according to whether or not it is accessible.
Wherein the step of determining whether to change the identification information comprises changing the corresponding identification information when the node is accessible,
Wherein releasing the area of the non-volatile memory includes releasing the area of the corresponding non-volatile memory if the identification information is not changed.
Wherein the step of determining whether to change the identification information comprises changing the corresponding identification information when the node is inaccessible,
Wherein releasing the area of the non-volatile memory includes releasing the area of the corresponding non-volatile memory when the identification information is changed.
Further comprising initializing identification information corresponding to an accessible node after releasing the area of the non-volatile memory.
A generating unit for generating identification information indicating whether the data structure can be accessed for each node; And
A release unit for releasing an area of the non-volatile memory allocated to a node corresponding to a pointer disconnected in the data structure according to the identification information,
And the memory leak prevention device.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020150052609 | 2015-04-14 | ||
KR20150052609 | 2015-04-14 |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20160122618A true KR20160122618A (en) | 2016-10-24 |
KR101669762B1 KR101669762B1 (en) | 2016-10-26 |
Family
ID=57251630
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020150095967A KR101669762B1 (en) | 2015-04-14 | 2015-07-06 | Method and apparatus for recovering leakage of nonvolatile memory |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR101669762B1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20210026619A (en) | 2019-08-30 | 2021-03-10 | 삼성전자주식회사 | Electronic device and operating method thereof |
KR20230173437A (en) * | 2022-06-17 | 2023-12-27 | 삼성전자주식회사 | Apparatus and method for operating a memory in an electronic device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20070079064A (en) * | 2006-01-31 | 2007-08-03 | 베리지 (싱가포르) 피티이. 엘티디. | Data tree structure for automatic retention of context information |
KR20090112491A (en) * | 2008-04-24 | 2009-10-28 | 주식회사 파수닷컴 | Memory Leak Detecting Apparatus and Method thereof |
KR20140142124A (en) * | 2013-05-30 | 2014-12-11 | 한양대학교 산학협력단 | Apparatus and method for managing table |
-
2015
- 2015-07-06 KR KR1020150095967A patent/KR101669762B1/en active IP Right Grant
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20070079064A (en) * | 2006-01-31 | 2007-08-03 | 베리지 (싱가포르) 피티이. 엘티디. | Data tree structure for automatic retention of context information |
KR20090112491A (en) * | 2008-04-24 | 2009-10-28 | 주식회사 파수닷컴 | Memory Leak Detecting Apparatus and Method thereof |
KR20140142124A (en) * | 2013-05-30 | 2014-12-11 | 한양대학교 산학협력단 | Apparatus and method for managing table |
Also Published As
Publication number | Publication date |
---|---|
KR101669762B1 (en) | 2016-10-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11243706B2 (en) | Fragment management method and fragment management apparatus | |
KR101357397B1 (en) | Method for tracking memory usages of a data processing system | |
CN108572792B (en) | Data storage method and device, electronic equipment and computer readable storage medium | |
CN108733309B (en) | Storage management method, apparatus and computer readable medium | |
US8682850B2 (en) | Method of enhancing de-duplication impact by preferential selection of master copy to be retained | |
KR102329762B1 (en) | Electronic system with memory data protection mechanism and method of operation thereof | |
CN101599046B (en) | Method and device for detecting memory | |
US20170270000A1 (en) | Method for storage management and storage device | |
CN104350478A (en) | System and method for object deletion in persistent memory using bitmap windows | |
CN107479834A (en) | A kind of file memory method and device based on COS | |
US9734620B2 (en) | Apparatus and method for graphics state management | |
KR101669762B1 (en) | Method and apparatus for recovering leakage of nonvolatile memory | |
CN105893266B (en) | Method and apparatus for reusing storage blocks of a file system | |
US20060236065A1 (en) | Method and system for variable dynamic memory management | |
CN107544834B (en) | Mirror image file contraction method and device and machine-readable storage medium | |
CN103823641A (en) | Online expanded virtual volume system and realizing method thereof | |
CN102043589B (en) | Disk array capacity expansion method and system | |
CN109739688B (en) | Snapshot resource space management method and device and electronic equipment | |
CN110704244B (en) | Disk offline processing method, device and equipment and readable storage medium | |
TWI461904B (en) | Recovery method and device for linux using fat file system | |
CN109508140B (en) | Storage resource management method and device, electronic equipment and system | |
US8918617B2 (en) | Defragmentation of storage class memory managed in extents | |
KR101726361B1 (en) | Method and apparatus for hybrid garbage collection | |
US20130247063A1 (en) | Computing device and method for managing memory of virtual machines | |
CN113760781A (en) | Data processing method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant | ||
FPAY | Annual fee payment |
Payment date: 20190905 Year of fee payment: 4 |