KR101669762B1 - Method and apparatus for recovering leakage of nonvolatile memory - Google Patents

Method and apparatus for recovering leakage of nonvolatile memory Download PDF

Info

Publication number
KR101669762B1
KR101669762B1 KR1020150095967A KR20150095967A KR101669762B1 KR 101669762 B1 KR101669762 B1 KR 101669762B1 KR 1020150095967 A KR1020150095967 A KR 1020150095967A KR 20150095967 A KR20150095967 A KR 20150095967A KR 101669762 B1 KR101669762 B1 KR 101669762B1
Authority
KR
South Korea
Prior art keywords
node
identification information
data structure
area
memory
Prior art date
Application number
KR1020150095967A
Other languages
Korean (ko)
Other versions
KR20160122618A (en
Inventor
손한근
원유집
정재민
Original Assignee
한양대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 한양대학교 산학협력단 filed Critical 한양대학교 산학협력단
Publication of KR20160122618A publication Critical patent/KR20160122618A/en
Application granted granted Critical
Publication of KR101669762B1 publication Critical patent/KR101669762B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/20Employing a main memory using a specific memory technology
    • G06F2212/202Non-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

METHOD AND APPARATUS FOR RECOVERING LEAKAGE OF NONVOLATILE MEMORY BACKGROUND OF THE INVENTION [0001]

BACKGROUND OF THE INVENTION 1. Field of the Invention [0001] The present invention relates to a method and apparatus for managing a memory of a nonvolatile memory, and more particularly, to a method and apparatus for judging whether or not a nonvolatile memory is leaking.

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, step 100 may indicate a state in which a new node is allocated to the connected data structure. Connected data structures are also called linear structures. The concatenated data structure may be a stack structure, a queue structure, and a deck structure. The processor may create a new node and allocate the storage space of the new node in the unallocated area of non-volatile memory.

Step 101 may indicate a state in which the pointer of the new node changes to point to a node connected to the head. The pointer to the new node can store the address and store the address of the node pointed to by the head of the connected data structure.

Step 102 may indicate an abnormally terminated state of the process while changing the pointer of the head to point to the new node. Abnormal termination of a process may mean failure of the user or sudden interruption of power supply.

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 node 1 after step 101. In other words, you need to store the address of the new node in the head pointer instead of the address of node 1.

However, if the processor is abnormally terminated, the insertion process may be interrupted before the node 1 and the head pointer are disconnected and the new node is connected. In this case, the head will not know the address of the connection type data structure, and a memory leak will occur.

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 step 501 is initialized to zero. At this time, 0 can be promised to mean inaccessible state.

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 node 1 and then changing the identification information. As node 1 is an accessible node, as shown in FIG. 2, the processor may change the corresponding identification information to one.

Step 502 may indicate a process of searching for node 2 and then changing the identification information. Since node 2 is an accessible node, as shown in FIG. 2, the processor may change the corresponding identification information to one.

Thereafter, the processor must search for the left child node according to the depth-first search conventions. However, since node 3 is an inaccessible node, the physical address of node 3 is not stored in the node 2 pointer. That is, the pointer of node 2 does not point to node 3. Therefore, the processor keeps the identification information of the node 3 at zero.

Similarly, the processor can not access node 5. Therefore, the identification information corresponding to the node 5 can be held at zero. The processor can search node 4, the right child node of node 2, according to the depth-first search convention.

Step 503 may indicate a process of searching for the node 4 and then changing the identification information. Since node 4 is an accessible node, as shown in FIG. 2, the processor can change the corresponding identification information to one.

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 identification information 0 can be determined to be inaccessible. The processor can release the physical area by the size of the allocated area at the address of the corresponding allocated area. The released physical area may then be allocated if there is another allocation request.

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)

Allocating a memory to each node of a data structure to which a plurality of nodes are connected in response to a dynamic memory allocation request;
Determining whether the node is accessible from the parent node to the child node in the data structure;
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 >
The method according to claim 1,
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.
The method according to claim 1,
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.
The method of claim 3,
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.
The method of claim 3,
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.
The method according to claim 1,
Further comprising initializing identification information corresponding to an accessible node after releasing the area of the non-volatile memory.
An allocation unit allocating a memory to each node of a data structure to which a plurality of nodes are connected in response to a dynamic memory allocation request;
A determination unit for determining whether the node can be accessed from the parent node to the child node in the data structure;
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.
KR1020150095967A 2015-04-14 2015-07-06 Method and apparatus for recovering leakage of nonvolatile memory KR101669762B1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20150052609 2015-04-14
KR1020150052609 2015-04-14

Publications (2)

Publication Number Publication Date
KR20160122618A KR20160122618A (en) 2016-10-24
KR101669762B1 true 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11579927B2 (en) 2019-08-30 2023-02-14 Samsung Electronics Co., Ltd. Electronic device for securing usable dynamic memory and operating method thereof
WO2023243809A1 (en) * 2022-06-17 2023-12-21 삼성전자 주식회사 Memory operation apparatus and method for electronic device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070192080A1 (en) * 2006-01-31 2007-08-16 Carpenter Bryan F Data tree structure for automatic retention of context information
KR100965426B1 (en) * 2008-04-24 2010-06-24 주식회사 파수닷컴 Memory Leak Detecting Apparatus and Method thereof
KR101543861B1 (en) * 2013-05-30 2015-08-11 한양대학교 산학협력단 Apparatus and method for managing table

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11579927B2 (en) 2019-08-30 2023-02-14 Samsung Electronics Co., Ltd. Electronic device for securing usable dynamic memory and operating method thereof
WO2023243809A1 (en) * 2022-06-17 2023-12-21 삼성전자 주식회사 Memory operation apparatus and method for electronic device

Also Published As

Publication number Publication date
KR20160122618A (en) 2016-10-24

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
KR102329762B1 (en) Electronic system with memory data protection mechanism and method of operation thereof
US8682850B2 (en) Method of enhancing de-duplication impact by preferential selection of master copy to be retained
CN101414272B (en) Method and apparatus for detecting memory leakage
CN108733309B (en) Storage management method, apparatus and computer readable medium
CN101599046A (en) A kind of internal-memory detection method and device
CN106201652B (en) Data processing method and virtual machine
US20170270000A1 (en) Method for storage management and storage device
CN108037894B (en) Disk space management method and device
CN104350478A (en) System and method for object deletion in persistent memory using bitmap windows
CN114443332B (en) Storage pool detection method and device, electronic equipment and storage medium
CN107479834A (en) A kind of file memory method and device based on COS
US9734620B2 (en) Apparatus and method for graphics state management
CN102541969B (en) File protection method and system based on file allocation table (FAT) file system, and memory
CN109074308A (en) The block conversion table (BTT) of adaptability
KR101669762B1 (en) Method and apparatus for recovering leakage of nonvolatile memory
CN111324549B (en) Memory and control method and device thereof
CN107544834B (en) Mirror image file contraction method and device and machine-readable storage medium
US20060236065A1 (en) Method and system for variable dynamic memory management
CN109739688B (en) Snapshot resource space management method and device and electronic equipment
CN103176832B (en) One kind UNIX operating system runs method and the device of virtual opetrating system
TWI461904B (en) Recovery method and device for linux using fat file system
CN109508140B (en) Storage resource management method and device, electronic equipment and system

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