# US 2023/0409465 A1 · Device and method for operating memory in electronic device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0409465 A1
- Document ID: US20230409465A1
- Status: Published application
- Kind: A1
- Application number: 18/190,350
- Filed: 2023-03-27
- Published: 2023-12-21
- Earliest claimed: 2022-06-17
- Assignees: Samsung Electronics Co., Ltd.
- Applicants: Samsung Electronics Co., Ltd.
- Inventors: Jihun JUNG; Kyeonghwan JUNG; Changhyeon CHAE; Jaeook KWON; Jusun SONG; Jaehoon JEONG; Youngho CHOI
- Web page: https://patentgrep.com/patent/US20230409465A1

## CPC

- G06F 11/3636: {by tracing the execution of the program}
- G06F 11/076: {by exceeding a count or rate limit, e.g. word- or bit count limit}
- G06F 11/36: Prevention of errors by analysis, debugging or testing of software
- G06F 11/366: {using diagnostics (G06F11/0703 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A memory operation device and method for operating a memory in an electronic device. The electronic device may determine whether a memory leak occurs in one or more low-order stack trace items with a count value of n among collected stack trace items, n being a positive integer, and, based on a low-order stack trace item among the collected stack trace items being determined as causing a memory leak, proceeding to a next order of the collected stack trace items to thereby determine whether a memory leak occurs in one or more high-order stack trace items with a count value of m which is a positive integer higher than n). When m is a maximum count value among the collected stack trace items, memory debugging may be performed using a high-order stack trace item, among the one or more high-order stack trace items, causing the memory leak.

## Claims

### Claim 1

A method for operating a memory in an electronic device, comprising:
determining whether a memory leak occurs in one or more low-order stack trace items with a count value of n among collected stack trace items, n being a positive integer; and
based on a low-order stack trace item among the one or more low-order stack trace items being determined as causing the memory leak, proceeding to a next order of the collected stack trace items to thereby determine whether a memory leak occurs in one or more high-order stack trace items with a count value of m which is a positive integer higher than n,
wherein, when m is a maximum count value among the collected stack trace items, memory debugging is performed using a high-order stack trace item, among the one or more high-order stack trace items, causing the memory leak.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
in response to a memory allocation request being invoked equal to or greater than a preset number of times, obtaining a memory size allocated for the one or more low-order stack trace items or the one or more high-order stack trace items to determine whether the memory leak occurs.

### Claim 3 (depends on 2)

The method of claim 2, further comprising initializing the number of times in which the memory allocation request is invoked at a predetermined cycle.

### Claim 4 (depends on 1)

The method of claim 1, further comprising assigning an indicator indicating a stack trace item causing the memory leak to the low-order stack trace item causing the memory leak.

### Claim 5 (depends on 1)

The method of claim 1, wherein the maximum count value is a maximum number of functions invoked at a memory allocation request.

### Claim 6 (depends on 1)

The method of claim 1, wherein the maximum count value is a minimum number of functions required to determine a cause of the memory leak.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
determining a target processor requiring memory analysis among a plurality of processors; and
switching from a ready mode in which a memory debugger included in the target processor has an essential condition for debugging to a profile mode in which a profile function is included to perform the memory analysis.

### Claim 8

An electronic device, comprising:
a memory configured to include a stack area or a heap area; and
at least one processor configured to perform dynamic memory allocation on the memory and analyze a cause of a memory leak based on stack trace,
wherein the at least one processor is configured to:
determine whether a memory leak occurs in one or more low-order stack trace items with a count value of n among collected stack trace items, n being a positive integer; and
based on a low-order stack trace item among the one or more low-order stack trace items being determined as causing the memory leak, proceeding to a next order of the collected stack trace items to thereby determine whether a memory leak occurs in one or more high-order stack trace items with a count value of m which is a positive integer higher than n,
wherein when m is a maximum count value among the collected stack trace items, memory debugging is performed using a high-order stack trace item, among the one or more high-order stack trace items, causing the memory leak.

### Claim 9 (depends on 8)

The electronic device of claim 8, wherein the at least one processor is configured to in response to a memory allocation request being invoked equal to or greater than a preset number of times, obtain a memory size allocated for the one or more low-order stack trace items or the one or more high-order stack trace items to determine whether the memory leak occurs.

### Claim 10 (depends on 9)

The electronic device of claim 9, wherein the at least one processor is configured to initialize the number of times in which the memory allocation request is invoked at a predetermined cycle.

### Claim 11 (depends on 9)

The electronic device of claim 9, wherein the at least one processor is configured to assign an indicator indicating a stack trace item causing the memory leak to the low-order stack trace item causing the memory leak.

### Claim 12 (depends on 8)

The electronic device of claim 8, wherein the maximum count value is a maximum number of functions invoked at a memory allocation request.

### Claim 13 (depends on 8)

The electronic device of claim 8, wherein the maximum count value is a minimum number of functions required to determine a cause of the memory leak.

### Claim 14 (depends on 8)

The electronic device of claim 8, wherein the at least one processor is configured to determine a target processor requiring memory analysis among a plurality of processors and switch from a ready mode in which a memory debugger included in the target processor has an essential condition for debugging to a profile mode in which a profile function is included to perform the memory analysis.

### Claim 15

An electronic device, comprising:
a memory leak analysis module configured to determine whether a memory leak occurs in a stack trace item; and
a memory debugger configured to perform memory debugging based on a result of determining whether the memory leak occurs by the memory leak analysis module,
wherein the memory leak analysis module is configured to:
determine whether a memory leak occurs in one or more low-order stack trace items with a count value of n among collected stack trace items, n being a positive integer; and,
based on a low-order stack trace item among the one or more low-order stack trace items being determined as causing the memory leak, proceeding to a next order of collected stack trace items to thereby determine whether a memory leak occurs in one or more high-order stack trace items with a count value of m which is a positive integer higher than n,
wherein when m is a maximum count value among the collected stack trace items, the memory debugger configured to perform memory debugging using a high-order stack trace item, among the one or more high-order stack trace items, causing the memory leak.

### Claim 16 (depends on 15)

The electronic device of claim 15, wherein the memory leak analysis module is configured to initialize the number of times in which the memory allocation request is invoked at a predetermined cycle; and in response to the memory allocation request being invoked equal to or greater than a preset number of times, obtain a memory size allocated for the one or more low-order stack trace items or the one or more high-order stack trace items to determine whether the memory leak occurs.

### Claim 17 (depends on 15)

The electronic device of claim 15, wherein the memory leak analysis module is configured to assign an indicator indicating a stack trace item causing the memory leak to the low-order stack trace item causing the memory leak.

### Claim 18 (depends on 15)

The electronic device of claim 15, wherein the maximum count value is a maximum number of functions invoked at a memory allocation request.

### Claim 19 (depends on 15)

The electronic device of claim 15, wherein the maximum count value is a minimum number of functions required to determine a cause of the memory leak.

### Claim 20 (depends on 15)

The electronic device of claim 15, wherein the memory leak analysis module is configured to determine a target processor requiring memory analysis among a plurality of processors and switch from a ready mode in which a memory debugger included in the target processor has an essential condition for debugging to a profile mode in which a profile function is included to perform the memory analysis.
