# US 2023/0266883 A1 · Memory allocation method and apparatus, electronic device, and storage medium

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

- Number: US 2023/0266883 A1
- Document ID: US20230266883A1
- Status: Published application
- Kind: A1
- Application number: 17/810,005
- Filed: 2022-06-30
- Published: 2023-08-24
- Earliest claimed: 2022-02-24
- Assignees: Changxin Memory Technologies, Inc.
- Applicants: Changxin Memory Technologies, Inc.
- Inventors: Junwei LIAN
- Web page: https://patentgrep.com/patent/US20230266883A1

## CPC

- G06F 3/0617: {in relation to availability}
- G06F 9/5044: {considering hardware capabilities}
- G06F 3/0631: {by allocating resources to storage systems}
- G06F 3/0653: {Monitoring storage devices or systems}
- G06F 3/0659: {Command handling arrangements, e.g. command buffers, queues, command scheduling}
- G06F 3/0673: {Single storage device}
- G06F 9/5016: {the resource being the memory}
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

The present disclosure relates to the technical field of system-level memory test, and in particular, to a memory allocation method and apparatus, an electronic device, and a computer-readable storage medium. The method includes: obtaining a plurality of memory segments corresponding to a to-be-processed task, and determining a plurality of operation cores in an operation platform that executes the to-be-processed task; determining a first-capacity memory segment and a second-capacity memory segment in the plurality of memory segments according to the plurality of operation cores, wherein a memory capacity of the second-capacity memory segment is larger than a memory capacity of the first-capacity memory segment; allocating each first-capacity memory segment one by one to the operation cores, and determining remaining memory capacities corresponding to the operation cores respectively; and allocating the second-capacity memory segment to the operation cores according to the remaining memory capacities, to obtain a memory allocation result.

## Claims

### Claim 1

A memory allocation method, comprising:
obtaining a plurality of memory segments corresponding to a to-be-processed task, and determining a plurality of operation cores in an operation platform that executes the to-be-processed task;
determining a first-capacity memory segment and a second-capacity memory segment in the plurality of memory segments according to the plurality of operation cores, wherein a memory capacity of the second-capacity memory segment is larger than a memory capacity of the first-capacity memory segment;
allocating each first-capacity memory segment one by one to the operation cores, and determining remaining memory capacities corresponding to the operation cores respectively; and
allocating the second-capacity memory segment to the operation cores according to the remaining memory capacities, to obtain a memory allocation result.

### Claim 2 (depends on 1)

The method according to claim 1, wherein before the obtaining a plurality of memory segments corresponding to a to-be-processed task, the method further comprises:
obtaining the to-be-processed task, and determining a task operating requirement of the to-be-processed task;
determining a specified operating environment corresponding to the to-be-processed task according to the task operating requirement; and
determining the plurality of memory segments corresponding to the to-be-processed task in the specified operating environment.

### Claim 3 (depends on 2)

The method according to claim 2, wherein the determining the plurality of memory segments corresponding to the to-be-processed task in the specified operating environment comprises:
obtaining a memory configuration file corresponding to the specified operating environment, and determining a corresponding memory type according to the memory configuration file, wherein the memory type has corresponding segmental memories; and
configuring respective memory capacities corresponding to the segmental memories, to generate memory segments corresponding to the segmental memories respectively.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the obtaining a memory configuration file corresponding to the specified operating environment comprises:
entering the specified operating environment according to the task operating requirement in response to a boot-up instruction of the operation platform; and
obtaining a system operation file in the specified operating environment, and obtaining the memory configuration file from the system operation file.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the determining a first-capacity memory segment and a second-capacity memory segment in the plurality of memory segments according to the plurality of operation cores comprises:
determining a total memory capacity corresponding to the plurality of memory segments;
determining an operation core quantity of the operation platform;
determining a memory division reference value according to the total memory capacity and the operation core quantity, wherein the memory division reference value=the total memory capacity/the operation core quantity; and
determining the first-capacity memory segment and the second-capacity memory segment according to the memory division reference value.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the determining the first-capacity memory segment and the second-capacity memory segment according to the memory division reference value comprises:
determining a memory segment of which the memory capacity is less than the memory division reference value as the first-capacity memory segment; and
determining a memory segment of which the memory capacity is greater than or equal to the memory division reference value as the second-capacity memory segment.

### Claim 7 (depends on 1)

The method according to claim 1, wherein a quantity of the first-capacity memory segments are two or more, and the allocating each first-capacity memory segment one by one to the operation cores comprises:
using a preset arrangement order of the each first-capacity memory segment as a memory segment arrangement order of the each first-capacity memory segment; and
obtaining an operation core arrangement order of the plurality of operation cores, and allocating each first-capacity memory segment one by one to the operation cores according to the memory segment arrangement order and the operation core arrangement order.

### Claim 8 (depends on 7)

The method according to claim 7, wherein the allocating each first-capacity memory segment one by one to the operation cores according to the memory segment arrangement order and the operation core arrangement order comprises:
determining a memory segment identification (ID) corresponding to the each first-capacity memory segment according to the memory segment arrangement order;
determining an operation core ID corresponding to each of the operation cores according to the operation core arrangement order;
obtaining an operation core quantity, and determining a memory allocation ID according to the operation core quantity and the memory segment ID; and
allocating the each first-capacity memory segment to the corresponding operation cores according to the memory allocation ID and the operation core ID.

### Claim 9 (depends on 5)

The method according to claim 5, wherein the determining remaining memory capacities corresponding to the operation cores respectively comprises:
determining an allocated first-capacity memory segment in the operation cores, and determining an occupied memory capacity of the operation cores according to the allocated first-capacity memory segment; and
obtaining the memory division reference value, and determining the remaining memory capacity according to the memory division reference value and the occupied memory capacity.

### Claim 10 (depends on 1)

The method according to claim 1, wherein the allocating the second-capacity memory segment to the operation cores according to the remaining memory capacities comprises:
obtaining an operation core arrangement order of the plurality of operation cores; and
performing a remaining memory allocation step for the operation cores one by one according to the remaining memory capacities and the operation core arrangement order, so as to allocate the second-capacity memory segment to the operation cores.

### Claim 11 (depends on 10)

The method according to claim 10, wherein the remaining memory allocation step comprises:
obtaining a current operation core and a current-core remaining memory capacity corresponding to the current operation core;
determining, from the second-capacity memory segment, a remaining memory segment corresponding to the current operation core, wherein the remaining memory segment is a partial memory segment, which is the same as the current-core remaining memory capacity, in the second-capacity memory segment; and
allocating the remaining memory segment to the current operation core.

### Claim 12 (depends on 11)

The method according to claim 11, wherein the allocating the remaining memory segment to the current operation core comprises:
obtaining an occupied memory capacity and a memory start address of the current operation core;
determining a memory intermediate address corresponding to the current operation core according to the memory start address and the occupied memory capacity; and
determining a start address corresponding to the remaining memory segment according to the memory intermediate address.

### Claim 13 (depends on 2)

The method according to claim 2, further comprising:
executing the to-be-processed task in the specified operating environment according to the memory allocation result.

### Claim 14

A memory allocation apparatus, comprising:
a processor; and
a storage apparatus, configured to store a computer program, wherein the computer program, when executed by the processor, causes the processor to execute operations of:
obtaining a plurality of memory segments corresponding to a to-be-processed task, and determine a plurality of operation cores in an operation platform that executes the to-be-processed task;
determining a first-capacity memory segment and a second-capacity memory segment in the plurality of memory segments according to the plurality of operation cores, wherein a memory capacity of the second-capacity memory segment is larger than a memory capacity of the first-capacity memory segment;
allocating each first-capacity memory segment one by one to the operation cores, and determining remaining memory capacities corresponding to the operation cores respectively; and
allocating the second-capacity memory segment to the operation cores according to the remaining memory capacities, to obtain a memory allocation result.

### Claim 15

A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, causes the processor to execute operations of:
obtaining a plurality of memory segments corresponding to a to-be-processed task, and determine a plurality of operation cores in an operation platform that executes the to-be-processed task;
determining a first-capacity memory segment and a second-capacity memory segment in the plurality of memory segments according to the plurality of operation cores, wherein a memory capacity of the second-capacity memory segment is larger than a memory capacity of the first-capacity memory segment;
allocating each first-capacity memory segment one by one to the operation cores, and determining remaining memory capacities corresponding to the operation cores respectively; and
allocating the second-capacity memory segment to the operation cores according to the remaining memory capacities, to obtain a memory allocation result.
