KR102838101B1 - Method for allocating of virtual memory and electronic device supporting the same - Google Patents
Method for allocating of virtual memory and electronic device supporting the sameInfo
- Publication number
- KR102838101B1 KR102838101B1 KR1020200097640A KR20200097640A KR102838101B1 KR 102838101 B1 KR102838101 B1 KR 102838101B1 KR 1020200097640 A KR1020200097640 A KR 1020200097640A KR 20200097640 A KR20200097640 A KR 20200097640A KR 102838101 B1 KR102838101 B1 KR 102838101B1
- Authority
- KR
- South Korea
- Prior art keywords
- size
- heap area
- failure
- electronic device
- processor
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0631—Configuration or reconfiguration of storage systems by allocating resources to storage systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/0238—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0644—Management of space entities, e.g. partitions, extents, pools
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0653—Monitoring storage devices or systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0662—Virtualisation aspects
- G06F3/0665—Virtualisation aspects at area level, e.g. provisioning of virtual or logical volumes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0662—Virtualisation aspects
- G06F3/0667—Virtualisation aspects at data level, e.g. file, record or object virtualisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Memory System (AREA)
Abstract
전자 장치에 있어서, 어플리케이션을 저장하는 메모리, 및 상기 메모리와 작동적으로 연결된 프로세서를 포함하고, 상기 프로세서는, 상기 어플리케이션의 실행 중 상기 어플리케이션에 대응되는 가상 메모리에 대한 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하고, 상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 힙 영역의 크기를 결정하고, 상기 결정된 크기의 힙 영역을 포함하는 상기 가상 메모리를 할당하도록 설정된 전자 장치가 개시된다. 이 외에도 본 문서를 통해 파악되는 다양한 실시예들이 가능하다.In an electronic device, a memory for storing an application and a processor operatively connected to the memory, wherein the processor is configured to, if memory allocation for a virtual memory corresponding to the application fails during execution of the application, set information indicating a failure of the memory allocation, and, when the application is re-executed, if the set information exists, determine the size of a heap area included in the virtual memory based on the set information, and allocate the virtual memory including the heap area with the determined size. In addition to this, various embodiments are possible as identified through the present document.
Description
본 발명의 다양한 실시예들은 가상 메모리의 할당 기술에 관한 것이다.Various embodiments of the present invention relate to virtual memory allocation techniques.
데이터의 처리 또는 연산을 수행하는 전자 장치(또는 컴퓨팅 장치)는 실행되는 어플리케이션에 의해 사용되는 데이터 또는 명령어를 저장하기 위한 메모리를 포함할 수 있다. 이러한 메모리의 제한적인 저장 공간을 보다 효율적으로 사용하기 위해, 전자 장치는 가상 메모리를 사용하여 실제 물리적으로 존재하는 메모리의 용량보다 더 많은 저장 공간을 제공할 수 있다. 예를 들어, 전자 장치는 메모리의 저장 공간 일부를 가상 메모리로 설정하고, 가상 메모리로 설정된 메모리의 저장 공간에 대한 접근을 가상 주소(또는 논리 주소)를 통해 수행되도록 제어할 수 있다.An electronic device (or computing device) that performs data processing or calculations may include a memory for storing data or instructions used by an application that is being executed. In order to more efficiently use the limited storage space of such memory, the electronic device may use virtual memory to provide more storage space than the capacity of the actual physically existing memory. For example, the electronic device may set a portion of the storage space of the memory as virtual memory, and control access to the storage space of the memory set as virtual memory to be performed through a virtual address (or logical address).
한편, 가상 메모리는 어플리케이션 프로세스의 고유 공간인 사용자 영역 및 모든 어플리케이션 프로세스들이 공유하는 공간인 커널 영역을 포함할 수 있다. 또한, 사용자 영역은 어플리케이션이 사용하는 지역 변수와 같이 임시로 저장되는 데이터의 저장 공간인 스택(stack) 영역, 어플리케이션에 의해 동적으로 할당하는 공간인 힙(heap) 영역, 어플리케이션이 사용하는 전역 변수 또는 정적 변수와 같이 어플리케이션이 실행될 때 생성되고 어플리케이션이 종료되면 시스템에 반환되는 공간인 데이터(data) 영역, 및 어플리케이션의 명령어(또는 코드)가 기계어의 형태로 저장되는 공간인 코드(code) 영역을 포함할 수 있다.Meanwhile, virtual memory may include a user area, which is a unique space of an application process, and a kernel area, which is a space shared by all application processes. In addition, the user area may include a stack area, which is a storage space for data that is temporarily stored, such as local variables used by an application, a heap area, which is a space dynamically allocated by an application, a data area, which is a space created when an application is executed, such as global variables or static variables used by an application, and returned to the system when the application is terminated, and a code area, which is a space where the application's instructions (or codes) are stored in the form of machine language.
상술한 가상 메모리의 힙 영역은 네이티브 힙(native heap) 영역과 자바 가상 머신 힙(java virtual machine(JVM) heap) 영역을 포함할 수 있는데, 여기서 JVM 힙 영역은 어플리케이션 패키지 내의 설정 파일(예: "AndroidManifest.xml" 파일)에 기재된 힙 영역의 크기 속성(예: "largeHeap"으로 정의되는 속성)의 설정 값(예: "true" 또는 "false"(default 값))에 따라 결정될 수 있다. 예를 들어, 힙 영역의 크기 속성의 설정 값이 "true"로 설정된 경우, JVM 힙 영역은 최대로 사용 가능한 크기(예: 1GB)로 할당될 수 있다.The heap area of the virtual memory described above may include a native heap area and a Java virtual machine (JVM) heap area, where the JVM heap area may be determined by a setting value (e.g., "true" or "false" (default value)) of a size attribute of the heap area (e.g., an attribute defined as "largeHeap") described in a configuration file (e.g., the "AndroidManifest.xml" file) within the application package. For example, if the setting value of the size attribute of the heap area is set to "true", the JVM heap area may be allocated as the maximum available size (e.g., 1 GB).
기존의 전자 장치는 어플리케이션이 실행될 때, 어플리케이션 패키지 내의 설정 파일에 기재된 힙 영역의 크기 속성의 설정 값에 따라 가상 메모리의 힙 영역의 크기를 결정하기 때문에, 힙 영역의 크기가 실제 사용량과 상관없이 결정될 수 있다. 또한, 힙 영역의 크기는 어플리케이션이 실행될 때 한번 초기화되고 이후에는 조정하기 어려울 수 있다. 이에 따라, 어플리케이션에 대응되는 가상 메모리가 할당될 때, 메모리 공간 부족으로 인한 메모리 할당이 실패할 수 있다.Since existing electronic devices determine the size of the virtual memory heap area based on the setting value of the heap area size property described in the configuration file in the application package when the application is executed, the size of the heap area can be determined regardless of the actual usage. In addition, the size of the heap area is initialized once when the application is executed and can be difficult to adjust thereafter. Accordingly, when the virtual memory corresponding to the application is allocated, memory allocation may fail due to insufficient memory space.
본 발명의 다양한 실시예들은, 어플리케이션에 대응되는 가상 메모리의 할당 시 힙 영역의 실제 사용량에 기반하여 힙 영역의 크기를 결정하는 가상 메모리의 할당 방법 및 이를 지원하는 전자 장치를 제공할 수 있다.Various embodiments of the present invention can provide a virtual memory allocation method for determining the size of a heap area based on the actual usage of the heap area when allocating virtual memory corresponding to an application, and an electronic device supporting the method.
본 발명의 다양한 실시예에 따른 전자 장치는, 어플리케이션을 저장하는 메모리, 및 상기 메모리와 작동적으로 연결된 프로세서를 포함하고, 상기 프로세서는, 상기 어플리케이션의 실행 중 상기 어플리케이션에 대응되는 가상 메모리에 대한 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하고, 상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 힙 영역의 크기를 결정하고, 상기 결정된 크기의 힙 영역을 포함하는 상기 가상 메모리를 할당하도록 설정될 수 있다.An electronic device according to various embodiments of the present invention includes a memory storing an application, and a processor operatively connected to the memory, wherein the processor is configured to, when memory allocation for a virtual memory corresponding to the application fails during execution of the application, set information indicating a failure of the memory allocation, and, when the application is re-executed, determine a size of a heap area included in the virtual memory based on the set information if the set information exists, and allocate the virtual memory including the heap area with the determined size.
또한, 본 발명의 다양한 실시예에 따른 전자 장치의 가상 메모리의 할당 방법은, 상기 전자 장치의 메모리에 저장된 어플리케이션의 실행 중 상기 어플리케이션에 대응되는 가상 메모리에 대한 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하는 동작, 상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 힙 영역의 크기를 결정하는 동작, 및 상기 결정된 크기의 힙 영역을 포함하는 상기 가상 메모리를 할당하는 동작을 포함할 수 있다.In addition, a method for allocating virtual memory of an electronic device according to various embodiments of the present invention may include, when memory allocation for virtual memory corresponding to an application stored in a memory of the electronic device fails during execution of the application, an operation of setting information indicating a failure of the memory allocation; when the application is re-executed, if the set information exists, an operation of determining a size of a heap area included in the virtual memory based on the set information; and an operation of allocating the virtual memory including a heap area of the determined size.
본 발명의 다양한 실시예들에 따르면, 어플리케이션에 대응되는 가상 메모리의 할당 시 힙 영역의 실제 사용량에 기반하여 힙 영역의 크기를 결정함으로써, 가상 메모리의 저장 공간에 대한 효율성을 극대화할 수 있다.According to various embodiments of the present invention, by determining the size of a heap area based on the actual usage of the heap area when allocating virtual memory corresponding to an application, the efficiency of storage space of virtual memory can be maximized.
또한, 본 발명의 다양한 실시예들에 따르면, 가상 메모리의 할당에 대한 실패의 확률을 낮춤으로써, 메모리 사용에 대한 안정성을 높일 수 있다.In addition, according to various embodiments of the present invention, the stability of memory use can be increased by reducing the probability of failure in allocation of virtual memory.
이 외에, 본 문서를 통해 직접적 또는 간접적으로 파악되는 다양한 효과들이 제공될 수 있다.In addition, various effects may be provided that are directly or indirectly identified through this document.
도 1은 다양한 실시예들에 따른 네트워크 환경 내의 전자 장치의 블록도이다.
도 2는 본 발명의 일 실시예에 따른 가상 메모리의 할당과 관련된 전자 장치의 구성을 설명하기 위한 도면이다.
도 3은 본 발명의 일 실시예에 따른 가상 메모리에 대한 메모리 할당의 실패를 처리하는 방법을 설명하기 위한 도면이다.
도 4는 본 발명의 일 실시예에 따른 가상 메모리의 할당 방법을 설명하기 위한 도면이다.
도 5는 본 발명의 일 실시예에 따른 가상 메모리에 대한 메모리 할당의 실패와 관련된 정보를 설정하는 방법을 설명하기 위한 도면이다.
도 6은 본 발명의 일 실시예에 따른 가상 메모리의 할당과 관련된 처리 동작을 설명하기 위한 도면이다.
도면의 설명과 관련하여, 동일 또는 유사한 구성요소에 대해서는 동일 또는 유사한 참조 부호가 사용될 수 있다.FIG. 1 is a block diagram of an electronic device within a network environment according to various embodiments.
FIG. 2 is a drawing for explaining the configuration of an electronic device related to allocation of virtual memory according to one embodiment of the present invention.
FIG. 3 is a diagram for explaining a method for handling a failure in memory allocation for virtual memory according to one embodiment of the present invention.
FIG. 4 is a drawing for explaining a method for allocating virtual memory according to one embodiment of the present invention.
FIG. 5 is a diagram for explaining a method for setting information related to a failure in memory allocation for virtual memory according to one embodiment of the present invention.
FIG. 6 is a diagram for explaining processing operations related to allocation of virtual memory according to one embodiment of the present invention.
In connection with the description of the drawings, the same or similar reference numerals may be used for identical or similar components.
이하, 첨부된 도면을 참조하여 본 발명의 다양한 실시예들이 설명된다. 설명의 편의를 위하여 도면에 도시된 구성요소들은 그 크기가 과장 또는 축소될 수 있으며, 본 발명이 반드시 도시된 바에 의해 한정되는 것은 아니다.Hereinafter, various embodiments of the present invention will be described with reference to the attached drawings. For convenience of explanation, components illustrated in the drawings may be exaggerated or reduced in size, and the present invention is not necessarily limited to what is illustrated.
도 1은, 다양한 실시예들에 따른, 네트워크 환경(100) 내의 전자 장치(101)의 블록도이다. 도 1을 참조하면, 네트워크 환경(100)에서 전자 장치(101)는 제1 네트워크(198)(예: 근거리 무선 통신 네트워크)를 통하여 전자 장치(102)와 통신하거나, 또는 제2 네트워크(199)(예: 원거리 무선 통신 네트워크)를 통하여 전자 장치(104) 또는 서버(108)와 통신할 수 있다. 일 실시예에 따르면, 전자 장치(101)는 서버(108)를 통하여 전자 장치(104)와 통신할 수 있다. 일 실시예에 따르면, 전자 장치(101)는 프로세서(120), 메모리(130), 입력 모듈(150), 음향 출력 모듈(155), 디스플레이 모듈(160), 오디오 모듈(170), 센서 모듈(176), 인터페이스(177), 연결 단자(178), 햅틱 모듈(179), 카메라 모듈(180), 전력 관리 모듈(188), 배터리(189), 통신 모듈(190), 가입자 식별 모듈(196), 또는 안테나 모듈(197)을 포함할 수 있다. 어떤 실시예에서는, 전자 장치(101)에는, 이 구성요소들 중 적어도 하나(예: 연결 단자(178))가 생략되거나, 하나 이상의 다른 구성요소가 추가될 수 있다. 어떤 실시예에서는, 이 구성요소들 중 일부들(예: 센서 모듈(176), 카메라 모듈(180), 또는 안테나 모듈(197))은 하나의 구성요소(예: 디스플레이 모듈(160))로 통합될 수 있다.FIG. 1 is a block diagram of an electronic device (101) in a network environment (100) according to various embodiments. Referring to FIG. 1, in the network environment (100), the electronic device (101) may communicate with the electronic device (102) through a first network (198) (e.g., a short-range wireless communication network), or may communicate with the electronic device (104) or a server (108) through a second network (199) (e.g., a long-range wireless communication network). According to one embodiment, the electronic device (101) may communicate with the electronic device (104) through the server (108). According to one embodiment, the electronic device (101) may include a processor (120), a memory (130), an input module (150), an audio output module (155), a display module (160), an audio module (170), a sensor module (176), an interface (177), a connection terminal (178), a haptic module (179), a camera module (180), a power management module (188), a battery (189), a communication module (190), a subscriber identification module (196), or an antenna module (197). In some embodiments, the electronic device (101) may omit at least one of these components (e.g., the connection terminal (178)), or may have one or more other components added. In some embodiments, some of these components (e.g., the sensor module (176), the camera module (180), or the antenna module (197)) may be integrated into one component (e.g., the display module (160)).
프로세서(120)는, 예를 들면, 소프트웨어(예: 프로그램(140))를 실행하여 프로세서(120)에 연결된 전자 장치(101)의 적어도 하나의 다른 구성요소(예: 하드웨어 또는 소프트웨어 구성요소)를 제어할 수 있고, 다양한 데이터 처리 또는 연산을 수행할 수 있다. 일 실시예에 따르면, 데이터 처리 또는 연산의 적어도 일부로서, 프로세서(120)는 다른 구성요소(예: 센서 모듈(176) 또는 통신 모듈(190))로부터 수신된 명령 또는 데이터를 휘발성 메모리(132)에 저장하고, 휘발성 메모리(132)에 저장된 명령 또는 데이터를 처리하고, 결과 데이터를 비휘발성 메모리(134)에 저장할 수 있다. 일 실시예에 따르면, 프로세서(120)는 메인 프로세서(121)(예: 중앙 처리 장치 또는 어플리케이션 프로세서) 또는 이와는 독립적으로 또는 함께 운영 가능한 보조 프로세서(123)(예: 그래픽 처리 장치, 신경망 처리 장치(NPU: neural processing unit), 이미지 시그널 프로세서, 센서 허브 프로세서, 또는 커뮤니케이션 프로세서)를 포함할 수 있다. 예를 들어, 전자 장치(101)가 메인 프로세서(121) 및 보조 프로세서(123)를 포함하는 경우, 보조 프로세서(123)는 메인 프로세서(121)보다 저전력을 사용하거나, 지정된 기능에 특화되도록 설정될 수 있다. 보조 프로세서(123)는 메인 프로세서(121)와 별개로, 또는 그 일부로서 구현될 수 있다.The processor (120) may control at least one other component (e.g., a hardware or software component) of the electronic device (101) connected to the processor (120) by executing, for example, software (e.g., a program (140)), and may perform various data processing or calculations. According to one embodiment, as at least a part of the data processing or calculations, the processor (120) may store a command or data received from another component (e.g., a sensor module (176) or a communication module (190)) in the volatile memory (132), process the command or data stored in the volatile memory (132), and store result data in the nonvolatile memory (134). According to one embodiment, the processor (120) may include a main processor (121) (e.g., a central processing unit or an application processor) or an auxiliary processor (123) (e.g., a graphic processing unit, a neural processing unit (NPU), an image signal processor, a sensor hub processor, or a communication processor) that can operate independently or together therewith. For example, if the electronic device (101) includes a main processor (121) and a secondary processor (123), the secondary processor (123) may be configured to use lower power than the main processor (121) or to be specialized for a given function. The secondary processor (123) may be implemented separately from the main processor (121) or as a part thereof.
보조 프로세서(123)는, 예를 들면, 메인 프로세서(121)가 인액티브(예: 슬립) 상태에 있는 동안 메인 프로세서(121)를 대신하여, 또는 메인 프로세서(121)가 액티브(예: 어플리케이션 실행) 상태에 있는 동안 메인 프로세서(121)와 함께, 전자 장치(101)의 구성요소들 중 적어도 하나의 구성요소(예: 디스플레이 모듈(160), 센서 모듈(176), 또는 통신 모듈(190))와 관련된 기능 또는 상태들의 적어도 일부를 제어할 수 있다. 일 실시예에 따르면, 보조 프로세서(123)(예: 이미지 시그널 프로세서 또는 커뮤니케이션 프로세서)는 기능적으로 관련 있는 다른 구성요소(예: 카메라 모듈(180) 또는 통신 모듈(190))의 일부로서 구현될 수 있다. 일 실시예에 따르면, 보조 프로세서(123)(예: 신경망 처리 장치)는 인공지능 모델의 처리에 특화된 하드웨어 구조를 포함할 수 있다. 인공지능 모델은 기계 학습을 통해 생성될 수 있다. 이러한 학습은, 예를 들어, 인공지능이 수행되는 전자 장치(101) 자체에서 수행될 수 있고, 별도의 서버(예: 서버(108))를 통해 수행될 수도 있다. 학습 알고리즘은, 예를 들어, 지도형 학습(supervised learning), 비지도형 학습(unsupervised learning), 준지도형 학습(semi-supervised learning) 또는 강화 학습(reinforcement learning)을 포함할 수 있으나, 전술한 예에 한정되지 않는다. 인공지능 모델은, 복수의 인공 신경망 레이어들을 포함할 수 있다. 인공 신경망은 심층 신경망(DNN: deep neural network), CNN(convolutional neural network), RNN(recurrent neural network), RBM(restricted boltzmann machine), DBN(deep belief network), BRDNN(bidirectional recurrent deep neural network), 심층 Q-네트워크(deep Q-networks) 또는 상기 중 둘 이상의 조합 중 하나일 수 있으나, 전술한 예에 한정되지 않는다. 인공지능 모델은 하드웨어 구조 이외에, 추가적으로 또는 대체적으로, 소프트웨어 구조를 포함할 수 있다.The auxiliary processor (123) may control at least a portion of functions or states associated with at least one of the components of the electronic device (101) (e.g., the display module (160), the sensor module (176), or the communication module (190)), for example, on behalf of the main processor (121) while the main processor (121) is in an inactive (e.g., sleep) state, or together with the main processor (121) while the main processor (121) is in an active (e.g., application execution) state. In one embodiment, the auxiliary processor (123) (e.g., an image signal processor or a communication processor) may be implemented as a part of another functionally related component (e.g., a camera module (180) or a communication module (190)). In one embodiment, the auxiliary processor (123) (e.g., a neural network processing device) may include a hardware structure specialized for processing artificial intelligence models. The artificial intelligence models may be generated through machine learning. Such learning may be performed, for example, in the electronic device (101) on which artificial intelligence is performed, or may be performed through a separate server (e.g., server (108)). The learning algorithm may include, for example, supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning, but is not limited to the examples described above. The artificial intelligence model may include a plurality of artificial neural network layers. The artificial neural network may be one of a deep neural network (DNN), a convolutional neural network (CNN), a recurrent neural network (RNN), a restricted Boltzmann machine (RBM), a deep belief network (DBN), a bidirectional recurrent deep neural network (BRDNN), deep Q-networks, or a combination of two or more of the above, but is not limited to the examples described above. In addition to the hardware structure, the artificial intelligence model may additionally or alternatively include a software structure.
메모리(130)는, 전자 장치(101)의 적어도 하나의 구성요소(예: 프로세서(120) 또는 센서 모듈(176))에 의해 사용되는 다양한 데이터를 저장할 수 있다. 데이터는, 예를 들어, 소프트웨어(예: 프로그램(140)) 및, 이와 관련된 명령에 대한 입력 데이터 또는 출력 데이터를 포함할 수 있다. 메모리(130)는, 휘발성 메모리(132) 또는 비휘발성 메모리(134)를 포함할 수 있다.The memory (130) can store various data used by at least one component (e.g., processor (120) or sensor module (176)) of the electronic device (101). The data can include, for example, software (e.g., program (140)) and input data or output data for commands related thereto. The memory (130) can include volatile memory (132) or nonvolatile memory (134).
프로그램(140)은 메모리(130)에 소프트웨어로서 저장될 수 있으며, 예를 들면, 운영 체제(142), 미들웨어(144) 또는 어플리케이션(146)을 포함할 수 있다.The program (140) may be stored as software in memory (130) and may include, for example, an operating system (142), middleware (144), or an application (146).
입력 모듈(150)은, 전자 장치(101)의 구성요소(예: 프로세서(120))에 사용될 명령 또는 데이터를 전자 장치(101)의 외부(예: 사용자)로부터 수신할 수 있다. 입력 모듈(150)은, 예를 들면, 마이크, 마우스, 키보드, 키(예: 버튼), 또는 디지털 펜(예: 스타일러스 펜)을 포함할 수 있다.The input module (150) can receive commands or data to be used in a component of the electronic device (101) (e.g., a processor (120)) from an external source (e.g., a user) of the electronic device (101). The input module (150) can include, for example, a microphone, a mouse, a keyboard, a key (e.g., a button), or a digital pen (e.g., a stylus pen).
음향 출력 모듈(155)은 음향 신호를 전자 장치(101)의 외부로 출력할 수 있다. 음향 출력 모듈(155)은, 예를 들면, 스피커 또는 리시버를 포함할 수 있다. 스피커는 멀티미디어 재생 또는 녹음 재생과 같이 일반적인 용도로 사용될 수 있다. 리시버는 착신 전화를 수신하기 위해 사용될 수 있다. 일 실시예에 따르면, 리시버는 스피커와 별개로, 또는 그 일부로서 구현될 수 있다.The audio output module (155) can output an audio signal to the outside of the electronic device (101). The audio output module (155) can include, for example, a speaker or a receiver. The speaker can be used for general purposes such as multimedia playback or recording playback. The receiver can be used to receive an incoming call. According to one embodiment, the receiver can be implemented separately from the speaker or as a part thereof.
디스플레이 모듈(160)은 전자 장치(101)의 외부(예: 사용자)로 정보를 시각적으로 제공할 수 있다. 디스플레이 모듈(160)은, 예를 들면, 디스플레이, 홀로그램 장치, 또는 프로젝터 및 해당 장치를 제어하기 위한 제어 회로를 포함할 수 있다. 일 실시예에 따르면, 디스플레이 모듈(160)은 터치를 감지하도록 설정된 터치 센서, 또는 상기 터치에 의해 발생되는 힘의 세기를 측정하도록 설정된 압력 센서를 포함할 수 있다.The display module (160) can visually provide information to an external party (e.g., a user) of the electronic device (101). The display module (160) can include, for example, a display, a holographic device, or a projector and a control circuit for controlling the device. According to one embodiment, the display module (160) can include a touch sensor configured to detect a touch, or a pressure sensor configured to measure the intensity of a force generated by the touch.
오디오 모듈(170)은 소리를 전기 신호로 변환시키거나, 반대로 전기 신호를 소리로 변환시킬 수 있다. 일 실시예에 따르면, 오디오 모듈(170)은, 입력 모듈(150)을 통해 소리를 획득하거나, 음향 출력 모듈(155), 또는 전자 장치(101)와 직접 또는 무선으로 연결된 외부 전자 장치(예: 전자 장치(102))(예: 스피커 또는 헤드폰)를 통해 소리를 출력할 수 있다.The audio module (170) can convert sound into an electrical signal, or vice versa, convert an electrical signal into sound. According to one embodiment, the audio module (170) can obtain sound through an input module (150), or output sound through an audio output module (155), or an external electronic device (e.g., an electronic device (102)) (e.g., a speaker or a headphone) directly or wirelessly connected to the electronic device (101).
센서 모듈(176)은 전자 장치(101)의 작동 상태(예: 전력 또는 온도), 또는 외부의 환경 상태(예: 사용자 상태)를 감지하고, 감지된 상태에 대응하는 전기 신호 또는 데이터 값을 생성할 수 있다. 일 실시예에 따르면, 센서 모듈(176)은, 예를 들면, 제스처 센서, 자이로 센서, 기압 센서, 마그네틱 센서, 가속도 센서, 그립 센서, 근접 센서, 컬러 센서, IR(infrared) 센서, 생체 센서, 온도 센서, 습도 센서, 또는 조도 센서를 포함할 수 있다.The sensor module (176) can detect an operating state (e.g., power or temperature) of the electronic device (101) or an external environmental state (e.g., user state) and generate an electric signal or data value corresponding to the detected state. According to one embodiment, the sensor module (176) can include, for example, a gesture sensor, a gyro sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a grip sensor, a proximity sensor, a color sensor, an IR (infrared) sensor, a biometric sensor, a temperature sensor, a humidity sensor, or an illuminance sensor.
인터페이스(177)는 전자 장치(101)가 외부 전자 장치(예: 전자 장치(102))와 직접 또는 무선으로 연결되기 위해 사용될 수 있는 하나 이상의 지정된 프로토콜들을 지원할 수 있다. 일 실시예에 따르면, 인터페이스(177)는, 예를 들면, HDMI(high definition multimedia interface), USB(universal serial bus) 인터페이스, SD카드 인터페이스, 또는 오디오 인터페이스를 포함할 수 있다.The interface (177) may support one or more designated protocols that may be used to directly or wirelessly connect the electronic device (101) with an external electronic device (e.g., the electronic device (102)). According to one embodiment, the interface (177) may include, for example, a high definition multimedia interface (HDMI), a universal serial bus (USB) interface, an SD card interface, or an audio interface.
연결 단자(178)는, 그를 통해서 전자 장치(101)가 외부 전자 장치(예: 전자 장치(102))와 물리적으로 연결될 수 있는 커넥터를 포함할 수 있다. 일 실시예에 따르면, 연결 단자(178)는, 예를 들면, HDMI 커넥터, USB 커넥터, SD 카드 커넥터, 또는 오디오 커넥터(예: 헤드폰 커넥터)를 포함할 수 있다.The connection terminal (178) may include a connector through which the electronic device (101) may be physically connected to an external electronic device (e.g., the electronic device (102)). According to one embodiment, the connection terminal (178) may include, for example, an HDMI connector, a USB connector, an SD card connector, or an audio connector (e.g., a headphone connector).
햅틱 모듈(179)은 전기적 신호를 사용자가 촉각 또는 운동 감각을 통해서 인지할 수 있는 기계적인 자극(예: 진동 또는 움직임) 또는 전기적인 자극으로 변환할 수 있다. 일 실시예에 따르면, 햅틱 모듈(179)은, 예를 들면, 모터, 압전 소자, 또는 전기 자극 장치를 포함할 수 있다.The haptic module (179) can convert an electrical signal into a mechanical stimulus (e.g., vibration or movement) or an electrical stimulus that a user can perceive through a tactile or kinesthetic sense. According to one embodiment, the haptic module (179) can include, for example, a motor, a piezoelectric element, or an electrical stimulation device.
카메라 모듈(180)은 정지 영상 및 동영상을 촬영할 수 있다. 일 실시예에 따르면, 카메라 모듈(180)은 하나 이상의 렌즈들, 이미지 센서들, 이미지 시그널 프로세서들, 또는 플래시들을 포함할 수 있다.The camera module (180) can capture still images and moving images. According to one embodiment, the camera module (180) can include one or more lenses, image sensors, image signal processors, or flashes.
전력 관리 모듈(188)은 전자 장치(101)에 공급되는 전력을 관리할 수 있다. 일 실시예에 따르면, 전력 관리 모듈(188)은, 예를 들면, PMIC(power management integrated circuit)의 적어도 일부로서 구현될 수 있다.The power management module (188) can manage power supplied to the electronic device (101). According to one embodiment, the power management module (188) can be implemented as, for example, at least a part of a power management integrated circuit (PMIC).
배터리(189)는 전자 장치(101)의 적어도 하나의 구성요소에 전력을 공급할 수 있다. 일 실시예에 따르면, 배터리(189)는, 예를 들면, 재충전 불가능한 1차 전지, 재충전 가능한 2차 전지 또는 연료 전지를 포함할 수 있다.The battery (189) can power at least one component of the electronic device (101). In one embodiment, the battery (189) can include, for example, a non-rechargeable primary battery, a rechargeable secondary battery, or a fuel cell.
통신 모듈(190)은 전자 장치(101)와 외부 전자 장치(예: 전자 장치(102), 전자 장치(104), 또는 서버(108)) 간의 직접(예: 유선) 통신 채널 또는 무선 통신 채널의 수립, 및 수립된 통신 채널을 통한 통신 수행을 지원할 수 있다. 통신 모듈(190)은 프로세서(120)(예: 어플리케이션 프로세서)와 독립적으로 운영되고, 직접(예: 유선) 통신 또는 무선 통신을 지원하는 하나 이상의 커뮤니케이션 프로세서를 포함할 수 있다. 일 실시예에 따르면, 통신 모듈(190)은 무선 통신 모듈(192)(예: 셀룰러 통신 모듈, 근거리 무선 통신 모듈, 또는 GNSS(global navigation satellite system) 통신 모듈) 또는 유선 통신 모듈(194)(예: LAN(local area network) 통신 모듈, 또는 전력선 통신 모듈)을 포함할 수 있다. 이들 통신 모듈 중 해당하는 통신 모듈은 제1 네트워크(198)(예: 블루투스, WiFi(wireless fidelity) direct 또는 IrDA(infrared data association)와 같은 근거리 통신 네트워크) 또는 제2 네트워크(199)(예: 레거시 셀룰러 네트워크, 5G 네트워크, 차세대 통신 네트워크, 인터넷, 또는 컴퓨터 네트워크(예: LAN 또는 WAN)와 같은 원거리 통신 네트워크)를 통하여 외부의 전자 장치(104)와 통신할 수 있다. 이런 여러 종류의 통신 모듈들은 하나의 구성요소(예: 단일 칩)로 통합되거나, 또는 서로 별도의 복수의 구성요소들(예: 복수 칩들)로 구현될 수 있다. 무선 통신 모듈(192)은 가입자 식별 모듈(196)에 저장된 가입자 정보(예: 국제 모바일 가입자 식별자(IMSI))를 이용하여 제1 네트워크(198) 또는 제2 네트워크(199)와 같은 통신 네트워크 내에서 전자 장치(101)를 확인 또는 인증할 수 있다.The communication module (190) may support establishment of a direct (e.g., wired) communication channel or a wireless communication channel between the electronic device (101) and an external electronic device (e.g., the electronic device (102), the electronic device (104), or the server (108)), and performance of communication through the established communication channel. The communication module (190) may operate independently from the processor (120) (e.g., the application processor) and may include one or more communication processors that support direct (e.g., wired) communication or wireless communication. According to one embodiment, the communication module (190) may include a wireless communication module (192) (e.g., a cellular communication module, a short-range wireless communication module, or a GNSS (global navigation satellite system) communication module) or a wired communication module (194) (e.g., a local area network (LAN) communication module or a power line communication module). Among these communication modules, a corresponding communication module may communicate with an external electronic device (104) via a first network (198) (e.g., a short-range communication network such as Bluetooth, wireless fidelity (WiFi) direct, or infrared data association (IrDA)) or a second network (199) (e.g., a long-range communication network such as a legacy cellular network, a 5G network, a next-generation communication network, the Internet, or a computer network (e.g., a LAN or WAN)). These various types of communication modules may be integrated into a single component (e.g., a single chip) or implemented as multiple separate components (e.g., multiple chips). The wireless communication module (192) may use subscriber information (e.g., international mobile subscriber identity (IMSI)) stored in the subscriber identification module (196) to identify or authenticate the electronic device (101) within a communication network such as the first network (198) or the second network (199).
무선 통신 모듈(192)은 4G 네트워크 이후의 5G 네트워크 및 차세대 통신 기술, 예를 들어, NR 접속 기술(new radio access technology)을 지원할 수 있다. NR 접속 기술은 고용량 데이터의 고속 전송(eMBB(enhanced mobile broadband)), 단말 전력 최소화와 다수 단말의 접속(mMTC(massive machine type communications)), 또는 고신뢰도와 저지연(URLLC(ultra-reliable and low-latency communications))을 지원할 수 있다. 무선 통신 모듈(192)은, 예를 들어, 높은 데이터 전송률 달성을 위해, 고주파 대역(예: mmWave 대역)을 지원할 수 있다. 무선 통신 모듈(192)은 고주파 대역에서의 성능 확보를 위한 다양한 기술들, 예를 들어, 빔포밍(beamforming), 거대 배열 다중 입출력(massive MIMO(multiple-input and multiple-output)), 전차원 다중입출력(FD-MIMO: full dimensional MIMO), 어레이 안테나(array antenna), 아날로그 빔형성(analog beam-forming), 또는 대규모 안테나(large scale antenna)와 같은 기술들을 지원할 수 있다. 무선 통신 모듈(192)은 전자 장치(101), 외부 전자 장치(예: 전자 장치(104)) 또는 네트워크 시스템(예: 제2 네트워크(199))에 규정되는 다양한 요구사항을 지원할 수 있다. 일 실시예에 따르면, 무선 통신 모듈(192)은 eMBB 실현을 위한 Peak data rate(예: 20Gbps 이상), mMTC 실현을 위한 손실 Coverage(예: 164dB 이하), 또는 URLLC 실현을 위한 U-plane latency(예: 다운링크(DL) 및 업링크(UL) 각각 0.5ms 이하, 또는 라운드 트립 1ms 이하)를 지원할 수 있다.The wireless communication module (192) can support a 5G network and next-generation communication technology after a 4G network, for example, NR access technology (new radio access technology). The NR access technology can support high-speed transmission of high-capacity data (eMBB (enhanced mobile broadband)), terminal power minimization and connection of multiple terminals (mMTC (massive machine type communications)), or high reliability and low latency (URLLC (ultra-reliable and low-latency communications)). The wireless communication module (192) can support, for example, a high-frequency band (e.g., mmWave band) to achieve a high data transmission rate. The wireless communication module (192) may support various technologies for securing performance in a high-frequency band, such as beamforming, massive multiple-input and multiple-output (MIMO), full dimensional MIMO (FD-MIMO), array antenna, analog beam-forming, or large scale antenna. The wireless communication module (192) may support various requirements specified in an electronic device (101), an external electronic device (e.g., electronic device (104)), or a network system (e.g., second network (199)). According to one embodiment, the wireless communication module (192) may support a peak data rate (e.g., 20 Gbps or more) for eMBB realization, a loss coverage (e.g., 164 dB or less) for mMTC realization, or a U-plane latency (e.g., 0.5 ms or less for downlink (DL) and uplink (UL) each, or 1 ms or less for round trip) for URLLC realization.
안테나 모듈(197)은 신호 또는 전력을 외부(예: 외부의 전자 장치)로 송신하거나 외부로부터 수신할 수 있다. 일 실시예에 따르면, 안테나 모듈(197)은 서브스트레이트(예: PCB) 위에 형성된 도전체 또는 도전성 패턴으로 이루어진 방사체를 포함하는 안테나를 포함할 수 있다. 일 실시예에 따르면, 안테나 모듈(197)은 복수의 안테나들(예: 어레이 안테나)을 포함할 수 있다. 이런 경우, 제1 네트워크(198) 또는 제2 네트워크(199)와 같은 통신 네트워크에서 사용되는 통신 방식에 적합한 적어도 하나의 안테나가, 예를 들면, 통신 모듈(190)에 의하여 상기 복수의 안테나들로부터 선택될 수 있다. 신호 또는 전력은 상기 선택된 적어도 하나의 안테나를 통하여 통신 모듈(190)과 외부의 전자 장치 간에 송신되거나 수신될 수 있다. 어떤 실시예에 따르면, 방사체 이외에 다른 부품(예: RFIC(radio frequency integrated circuit))이 추가로 안테나 모듈(197)의 일부로 형성될 수 있다.The antenna module (197) can transmit or receive signals or power to or from the outside (e.g., an external electronic device). According to one embodiment, the antenna module (197) can include an antenna including a radiator formed of a conductor or a conductive pattern formed on a substrate (e.g., a PCB). According to one embodiment, the antenna module (197) can include a plurality of antennas (e.g., an array antenna). In this case, at least one antenna suitable for a communication method used in a communication network, such as the first network (198) or the second network (199), can be selected from the plurality of antennas by, for example, the communication module (190). A signal or power can be transmitted or received between the communication module (190) and the external electronic device through the selected at least one antenna. According to some embodiments, in addition to the radiator, another component (e.g., a radio frequency integrated circuit (RFIC)) can be additionally formed as a part of the antenna module (197).
다양한 실시예에 따르면, 안테나 모듈(197)은 mmWave 안테나 모듈을 형성할 수 있다. 일 실시예에 따르면, mmWave 안테나 모듈은 인쇄 회로 기판, 상기 인쇄 회로 기판의 제1 면(예: 아래 면)에 또는 그에 인접하여 배치되고 지정된 고주파 대역(예: mmWave 대역)을 지원할 수 있는 RFIC, 및 상기 인쇄 회로 기판의 제2 면(예: 윗 면 또는 측 면)에 또는 그에 인접하여 배치되고 상기 지정된 고주파 대역의 신호를 송신 또는 수신할 수 있는 복수의 안테나들(예: 어레이 안테나)을 포함할 수 있다.According to various embodiments, the antenna module (197) may form a mmWave antenna module. According to one embodiment, the mmWave antenna module may include a printed circuit board, an RFIC positioned on or adjacent a first side (e.g., a bottom side) of the printed circuit board and capable of supporting a designated high-frequency band (e.g., a mmWave band), and a plurality of antennas (e.g., an array antenna) positioned on or adjacent a second side (e.g., a top side or a side) of the printed circuit board and capable of transmitting or receiving signals in the designated high-frequency band.
상기 구성요소들 중 적어도 일부는 주변 기기들간 통신 방식(예: 버스, GPIO(general purpose input and output), SPI(serial peripheral interface), 또는 MIPI(mobile industry processor interface))을 통해 서로 연결되고 신호(예: 명령 또는 데이터)를 상호간에 교환할 수 있다.At least some of the above components may be interconnected and exchange signals (e.g., commands or data) with each other via a communication method between peripheral devices (e.g., a bus, a general purpose input and output (GPIO), a serial peripheral interface (SPI), or a mobile industry processor interface (MIPI)).
일 실시예에 따르면, 명령 또는 데이터는 제2 네트워크(199)에 연결된 서버(108)를 통해서 전자 장치(101)와 외부의 전자 장치(104)간에 송신 또는 수신될 수 있다. 외부의 전자 장치(102 또는 104) 각각은 전자 장치(101)와 동일한 또는 다른 종류의 장치일 수 있다. 일 실시예에 따르면, 전자 장치(101)에서 실행되는 동작들의 전부 또는 일부는 외부의 전자 장치들(102, 104 또는 108) 중 하나 이상의 외부의 전자 장치들에서 실행될 수 있다. 예를 들면, 전자 장치(101)가 어떤 기능이나 서비스를 자동으로, 또는 사용자 또는 다른 장치로부터의 요청에 반응하여 수행해야 할 경우에, 전자 장치(101)는 기능 또는 서비스를 자체적으로 실행시키는 대신에 또는 추가적으로, 하나 이상의 외부의 전자 장치들에게 그 기능 또는 그 서비스의 적어도 일부를 수행하라고 요청할 수 있다. 상기 요청을 수신한 하나 이상의 외부의 전자 장치들은 요청된 기능 또는 서비스의 적어도 일부, 또는 상기 요청과 관련된 추가 기능 또는 서비스를 실행하고, 그 실행의 결과를 전자 장치(101)로 전달할 수 있다. 전자 장치(101)는 상기 결과를, 그대로 또는 추가적으로 처리하여, 상기 요청에 대한 응답의 적어도 일부로서 제공할 수 있다. 이를 위하여, 예를 들면, 클라우드 컴퓨팅, 분산 컴퓨팅, 모바일 에지 컴퓨팅(MEC: mobile edge computing), 또는 클라이언트-서버 컴퓨팅 기술이 이용될 수 있다. 전자 장치(101)는, 예를 들어, 분산 컴퓨팅 또는 모바일 에지 컴퓨팅을 이용하여 초저지연 서비스를 제공할 수 있다. 다른 실시예에 있어서, 외부의 전자 장치(104)는 IoT(internet of things) 기기를 포함할 수 있다. 서버(108)는 기계 학습 및/또는 신경망을 이용한 지능형 서버일 수 있다. 일 실시예에 따르면, 외부의 전자 장치(104) 또는 서버(108)는 제2 네트워크(199) 내에 포함될 수 있다. 전자 장치(101)는 5G 통신 기술 및 IoT 관련 기술을 기반으로 지능형 서비스(예: 스마트 홈, 스마트 시티, 스마트 카, 또는 헬스 케어)에 적용될 수 있다.According to one embodiment, a command or data may be transmitted or received between the electronic device (101) and an external electronic device (104) via a server (108) connected to a second network (199). Each of the external electronic devices (102 or 104) may be the same or a different type of device as the electronic device (101). According to one embodiment, all or part of the operations executed in the electronic device (101) may be executed in one or more of the external electronic devices (102, 104 or 108). For example, when the electronic device (101) is to perform a certain function or service automatically or in response to a request from a user or another device, the electronic device (101) may, instead of or in addition to executing the function or service by itself, request one or more external electronic devices to perform the function or at least part of the service. One or more external electronic devices that receive the request may execute at least a part of the requested function or service, or an additional function or service related to the request, and transmit the result of the execution to the electronic device (101). The electronic device (101) may process the result as is or additionally and provide it as at least a part of a response to the request. For this purpose, for example, cloud computing, distributed computing, mobile edge computing (MEC), or client-server computing technology may be used. The electronic device (101) may provide an ultra-low latency service by using, for example, distributed computing or mobile edge computing. In another embodiment, the external electronic device (104) may include an IoT (Internet of Things) device. The server (108) may be an intelligent server using machine learning and/or a neural network. According to one embodiment, the external electronic device (104) or the server (108) may be included in the second network (199). The electronic device (101) can be applied to intelligent services (e.g., smart home, smart city, smart car, or healthcare) based on 5G communication technology and IoT-related technology.
도 2는 본 발명의 일 실시예에 따른 가상 메모리의 할당과 관련된 전자 장치의 구성을 설명하기 위한 도면이다.FIG. 2 is a drawing for explaining the configuration of an electronic device related to allocation of virtual memory according to one embodiment of the present invention.
도 2를 참조하면, 전자 장치(200)(예: 도 1의 전자 장치(101))는 메모리(210)(예: 도 1의 메모리(130)) 및 프로세서(230)(예: 도 1의 프로세서(120))를 포함할 수 있다. 그러나, 전자 장치(200)의 구성이 이에 한정되는 것은 아니다. 다양한 실시예에 따르면, 전자 장치(200)는 상술한 구성요소 외에 적어도 하나의 다른 구성요소를 더 포함할 수 있다. 예를 들어, 전자 장치(200)는 도 1에 도시된 구성요소들 중 적어도 하나를 더 포함할 수 있다.Referring to FIG. 2, the electronic device (200) (e.g., the electronic device (101) of FIG. 1) may include a memory (210) (e.g., the memory (130) of FIG. 1) and a processor (230) (e.g., the processor (120) of FIG. 1). However, the configuration of the electronic device (200) is not limited thereto. According to various embodiments, the electronic device (200) may further include at least one other component in addition to the components described above. For example, the electronic device (200) may further include at least one of the components illustrated in FIG. 1.
상기 메모리(210)는 전자 장치(200)의 적어도 하나의 구성요소에 의해 사용되는 다양한 데이터를 저장할 수 있다. 일 실시예에 따르면, 상기 메모리(210)는 상기 프로세서(230)에 의해 실행될 수 있는 어플리케이션(211)을 저장할 수 있다.The above memory (210) can store various data used by at least one component of the electronic device (200). According to one embodiment, the memory (210) can store an application (211) that can be executed by the processor (230).
상기 프로세서(230)는 전자 장치(200)의 적어도 하나의 다른 구성요소를 제어할 수 있고, 다양한 데이터 처리 또는 연산을 수행할 수 있다. 일 실시예에 따르면, 상기 프로세서(230)는 상기 메모리(210)에 저장된 상기 어플리케이션(211)을 실행시킬 수 있다. 상기 프로세서(230)는 상기 어플리케이션(211)을 실행시키는 과정에서, 상기 메모리(210)의 제한적인 저장 공간을 보다 효율적으로 사용하기 위해, 가상 메모리(250)를 사용하여 실제 물리적으로 존재하는 메모리(210)의 용량보다 더 많은 저장 공간을 제공할 수 있다. 예를 들어, 상기 프로세서(230)는 상기 메모리(210)의 저장 공간 일부를 가상 메모리(250)로 설정하고, 가상 메모리(250)로 설정된 상기 메모리(210)의 저장 공간에 대한 접근을 가상 주소(또는 논리 주소)를 통해 수행되도록 제어할 수 있다.The processor (230) may control at least one other component of the electronic device (200) and perform various data processing or calculations. According to one embodiment, the processor (230) may execute the application (211) stored in the memory (210). In the process of executing the application (211), the processor (230) may use a virtual memory (250) to provide a larger storage space than the capacity of the memory (210) that actually physically exists, in order to more efficiently use the limited storage space of the memory (210). For example, the processor (230) may set a part of the storage space of the memory (210) as a virtual memory (250) and control access to the storage space of the memory (210) set as the virtual memory (250) to be performed through a virtual address (or a logical address).
상기 가상 메모리(250)는 특정 어플리케이션(211)의 프로세스의 고유 공간인 사용자 영역 및 모든 어플리케이션(211)들의 프로세스들이 공유하는 공간인 커널 영역을 포함할 수 있다. 여기서, 프로세스는 하나의 시스템 즉, 전자 장치(200) 내에서 작동되는 프로그램을 나타낼 수 있다. 상기 사용자 영역은 어플리케이션(211)이 사용하는 지역 변수와 같이 임시로 저장되는 데이터의 저장 공간인 스택 영역(251), 어플리케이션(211)에 의해 동적으로 할당하는 공간인 힙 영역(253), 어플리케이션(211)이 사용하는 전역 변수 또는 정적 변수와 같이 어플리케이션(211)이 실행될 때 생성되고 어플리케이션(211)이 종료되면 시스템에 반환되는 공간인 데이터 영역(255), 및 어플리케이션(211)의 명령어(또는 코드)가 기계어의 형태로 저장되는 공간인 코드 영역(257)을 포함할 수 있다.The above virtual memory (250) may include a user area, which is a unique space of a process of a specific application (211), and a kernel area, which is a space shared by the processes of all applications (211). Here, a process may represent a program operating within a system, i.e., an electronic device (200). The user area may include a stack area (251), which is a storage space for data temporarily stored, such as local variables used by the application (211), a heap area (253), which is a space dynamically allocated by the application (211), a data area (255), which is a space created when the application (211) is executed, such as global variables or static variables used by the application (211), and returned to the system when the application (211) is terminated, and a code area (257), which is a space where instructions (or codes) of the application (211) are stored in the form of machine language.
일 실시예에 따르면, 상기 프로세서(230)는 어플리케이션(211)을 실행할 때, 상기 어플리케이션(211)의 설정 파일(예: 상기 어플리케이션(211)의 패키지에 포함된 "AndroidManifest.xml" 파일)에 기재된 힙 영역(253)의 크기 속성(예: "largeHeap"으로 정의되는 속성)의 설정 값(예: "true" 또는 "false"(default 값))에 따라 상기 어플리케이션(211)에 대응되는 가상 메모리(250)의 힙 영역(253)의 크기를 결정할 수 있다. 예를 들어, 상기 힙 영역(253)의 크기 속성의 설정 값이 "true"로 설정된 경우, 상기 프로세서(230)는 상기 힙 영역(253) 중 JVM 힙 영역을 최대로 사용 가능한 크기(예: 1GB)로 할당할 수 있다.According to one embodiment, when executing an application (211), the processor (230) may determine the size of the heap area (253) of the virtual memory (250) corresponding to the application (211) according to the setting value (e.g., “true” or “false” (default value)) of the size attribute (e.g., an attribute defined as “largeHeap”) of the heap area (253) described in a configuration file of the application (211) (e.g., an “AndroidManifest.xml” file included in a package of the application (211). For example, when the setting value of the size attribute of the heap area (253) is set to “true,” the processor (230) may allocate a JVM heap area among the heap areas (253) to the maximum available size (e.g., 1 GB).
일 실시예에 따르면, 상기 프로세서(230)는 어플리케이션(211)을 실행할 때, 상기 어플리케이션(211)에 대응되는 가상 메모리(250)에 대한 메모리 할당의 실패를 나타내는 정보(이하, 프로파일이라 한다)가 존재하는 경우, 상기 프로파일에 기반하여 상기 가상 메모리(250)의 힙 영역(253)의 크기를 결정할 수 있다. 이 경우, 상기 프로세서(230)는 상기 어플리케이션(211)의 설정 파일에 기재된 힙 영역(253)의 크기 속성의 설정 값을 무시할 수 있다. 예를 들어, 상기 프로세서(230)는 어플리케이션(211)을 실행하는 중에 상기 어플리케이션(211)에 대응되는 가상 메모리(250)에 대한 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보 즉, 프로파일을 설정할 수 있고, 설정된 프로파일을 상기 메모리(210)에 저장할 수 있다. 일 실시예에 따르면, 상기 프로파일이 상기 메모리(210)에 저장되어 있지 않은 경우, 상기 프로세서(230)는 상기 프로파일을 새로 생성할 수 있고, 상기 프로파일이 상기 메모리(210)에 저장되어 있는 경우, 상기 프로세서(230)는 상기 저장된 프로파일을 수정(또는 변경)할 수 있다. 일 실시예에 따르면, 상기 프로파일은 상기 메모리(210)에 파일 형태로 저장될 수 있다. 또한, 상기 프로세서(230)는 상기 프로파일이 존재하는 경우, 상기 어플리케이션(211)의 재실행 시, 상기 프로파일에 기반하여 상기 가상 메모리(250)의 힙 영역(253)의 크기를 결정할 수 있다.According to one embodiment, when executing an application (211), if there is information (hereinafter, referred to as a profile) indicating a failure in memory allocation for a virtual memory (250) corresponding to the application (211), the processor (230) may determine the size of the heap area (253) of the virtual memory (250) based on the profile. In this case, the processor (230) may ignore the setting value of the size attribute of the heap area (253) described in the setting file of the application (211). For example, if memory allocation for a virtual memory (250) corresponding to the application (211) fails while executing the application (211), the processor (230) may set information indicating a failure in the memory allocation, i.e., a profile, and store the set profile in the memory (210). According to one embodiment, if the profile is not stored in the memory (210), the processor (230) can create a new profile, and if the profile is stored in the memory (210), the processor (230) can modify (or change) the stored profile. According to one embodiment, the profile can be stored in the memory (210) in the form of a file. In addition, if the profile exists, the processor (230) can determine the size of the heap area (253) of the virtual memory (250) based on the profile when the application (211) is re-executed.
일 실시예에 따르면, 상기 프로세서(230)는 상기 메모리 할당이 실패하면, 상기 어플리케이션(211)의 실행에 따른 상기 힙 영역(253)의 실제 사용량을 상기 프로파일에 포함시킬 수 있다. 예컨대, 상기 프로세서(230)는 상기 메모리 할당이 실패하는 경우, 상기 메모리 할당이 실패한 시점을 기준으로 상기 힙 영역(253)의 실제 사용량에 대한 정보를 확인하여 상기 프로파일에 기록할 수 있다. 또한, 상기 프로세서(230)는 상기 가상 메모리(250)의 할당 시, 상기 프로파일에 기록된 상기 힙 영역(253)의 실제 사용량에 기반하여 상기 힙 영역(253)의 크기를 결정할 수 있다. 상기 힙 영역(253)의 크기가 상기 프로파일에 기록된 상기 힙 영역(253)의 실제 사용량에 기반하여 결정됨에 따라, 상기 가상 메모리(250)의 저장 공간에 대한 효율성이 극대화될 수 있으며, 상기 가상 메모리(250)에 대한 메모리 할당의 실패 확률이 낮아질 수 있다.According to one embodiment, if the memory allocation fails, the processor (230) may include the actual usage of the heap area (253) according to the execution of the application (211) in the profile. For example, if the memory allocation fails, the processor (230) may check information about the actual usage of the heap area (253) based on the time at which the memory allocation failed and record it in the profile. In addition, the processor (230) may determine the size of the heap area (253) based on the actual usage of the heap area (253) recorded in the profile when allocating the virtual memory (250). Since the size of the heap area (253) is determined based on the actual usage of the heap area (253) recorded in the profile, the efficiency of the storage space of the virtual memory (250) may be maximized, and the failure probability of memory allocation for the virtual memory (250) may be reduced.
일 실시예에 따르면, 상기 힙 영역(253)의 실제 사용량은 가상 메모리의 저장 공간 부족(out of memory)에 따른 메모리 할당에 대한 실패 신호의 발생시, 확인된 상기 힙 영역(253)의 사용량을 기반으로 계산될 수 있다.According to one embodiment, the actual usage of the heap area (253) can be calculated based on the usage of the heap area (253) confirmed when a failure signal for memory allocation occurs due to lack of storage space of virtual memory (out of memory).
일 실시예에 따르면, 상기 힙 영역(253)의 크기는 지정된 개수로 구분된 크기 범위들을 나타내는 단계 값으로 설정될 수 있다. 예를 들어, 상기 힙 영역(253)의 크기는 제1 단계 값(예: 256MB), 제2 단계 값(예: 384MB), 및 제3 단계 값(예: 512MB)으로 구분될 수 있다. 상기 제1 단계 값은 상기 힙 영역(253)의 크기의 최소값이 될 수 있고, 상기 힙 영역(253)의 실제 사용량이 상기 최소값 이하의 크기 범위(예: 0~256MB)에 포함될 때 설정될 수 있다. 마찬가지로, 상기 제2 단계 값은 상기 힙 영역(253)의 실제 사용량이 상기 최소값보다 크고 상기 제2 단계 값 이하의 크기 범위(예: 257~384MB)에 포함될 때 설정될 수 있고, 상기 제3 단계 값은 상기 힙 영역(253)의 실제 사용량이 상기 제2 단계 값보다 크고 상기 제3 단계 값 이하의 크기 범위(예: 385~512MB)에 포함될 때 설정될 수 있다. 여기서, 구분되는 단계 값의 개수가 이에 한정되는 것은 아니다. 상기 구분되는 단계 값의 개수는 상기 힙 영역(253)의 최대로 사용 가능한 크기에 따라 결정될 수 있고, 적어도 2개 이상이 될 수 있다.According to one embodiment, the size of the heap area (253) may be set as a step value representing size ranges divided by a specified number. For example, the size of the heap area (253) may be divided into a first step value (e.g., 256 MB), a second step value (e.g., 384 MB), and a third step value (e.g., 512 MB). The first step value may be a minimum value of the size of the heap area (253), and may be set when the actual usage of the heap area (253) is included in a size range (e.g., 0 to 256 MB) less than or equal to the minimum value. Similarly, the second step value may be set when the actual usage of the heap area (253) is greater than the minimum value and is within a size range (e.g., 257 to 384 MB) less than or equal to the second step value, and the third step value may be set when the actual usage of the heap area (253) is greater than the second step value and is within a size range (e.g., 385 to 512 MB) less than or equal to the third step value. Here, the number of distinct step values is not limited thereto. The number of distinct step values may be determined according to the maximum available size of the heap area (253), and may be at least two or more.
일 실시예에 따르면, 상기 프로세서(230)는 상기 가상 메모리(250)에 대한 메모리 할당의 실패의 종류에 따라 상기 힙 영역(253)의 크기를 증가 또는 감소시킬 수 있다. 일 예로, 상기 메모리 할당의 실패가 상기 가상 메모리(250)에 포함된 영역들 중 상기 힙 영역(253) 이외의 영역에 대한 저장 공간의 부족 시 발생되는 제1 실패인 경우, 상기 프로세서(230)는 상기 힙 영역(253)의 크기를 감소시킬 수 있다. 이를 위해, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 줄이기 위한 정보를 포함시킬 수 있다. 일 실시예에 따르면, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 적어도 한 단계 낮은 값으로 설정하도록 하는 정보를 기록할 수 있다. 예를 들어, 상기 힙 영역(253)의 현재의 크기가 상기 제3 단계 값으로 설정된 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 상기 제2 단계 값 또는 상기 제1 단계 값으로 설정하도록 하는 정보를 기록할 수 있다. 또 다른 예를 들어, 상기 힙 영역(253)의 현재의 크기가 상기 제2 단계 값으로 설정된 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 상기 제1 단계 값으로 설정하도록 하는 정보를 기록할 수 있다. According to one embodiment, the processor (230) may increase or decrease the size of the heap area (253) depending on the type of failure in memory allocation for the virtual memory (250). For example, if the failure in memory allocation is a first failure that occurs when there is a shortage of storage space for an area other than the heap area (253) among the areas included in the virtual memory (250), the processor (230) may reduce the size of the heap area (253). To this end, the processor (230) may include information for reducing the size of the heap area (253) in the profile. According to one embodiment, the processor (230) may record information for setting the size of the heap area (253) to a value at least one level lower in the profile. For example, if the current size of the heap area (253) is set to the third step value, the processor (230) can record information in the profile to set the size of the heap area (253) to the second step value or the first step value. For another example, if the current size of the heap area (253) is set to the second step value, the processor (230) can record information in the profile to set the size of the heap area (253) to the first step value.
다른 예로, 상기 메모리 할당의 실패가 상기 가상 메모리(250)에 포함된 영역들 중 상기 힙 영역(253)에 대한 저장 공간의 부족 시 발생되는 제2 실패인 경우, 상기 프로세서(230)는 상기 힙 영역(253)의 크기를 증가시킬 수 있다. 이를 위해, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 늘리기 위한 정보를 포함시킬 수 있다. 일 실시예에 따르면, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 적어도 한 단계 높은 값으로 설정하도록 하는 정보를 기록할 수 있다. 예를 들어, 상기 힙 영역(253)의 현재의 크기가 상기 제1 단계 값으로 설정된 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 상기 제2 단계 값 또는 상기 제3 단계 값으로 설정하도록 하는 정보를 기록할 수 있다. 또 다른 예를 들어, 상기 힙 영역(253)의 현재의 크기가 상기 제2 단계 값으로 설정된 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 상기 제3 단계 값으로 설정하도록 하는 정보를 기록할 수 있다.As another example, if the failure of the memory allocation is a second failure that occurs when there is a shortage of storage space for the heap area (253) among the areas included in the virtual memory (250), the processor (230) may increase the size of the heap area (253). To this end, the processor (230) may include information for increasing the size of the heap area (253) in the profile. According to one embodiment, the processor (230) may record information in the profile to set the size of the heap area (253) to a value at least one level higher. For example, if the current size of the heap area (253) is set to the first level value, the processor (230) may record information in the profile to set the size of the heap area (253) to the second level value or the third level value. For another example, if the current size of the heap area (253) is set to the second step value, the processor (230) may record information in the profile to set the size of the heap area (253) to the third step value.
상기 제1 실패는 예를 들어, 파일에 대한 메모리 매핑 기능을 수행하는 함수(예: mmap() 함수)의 사용 시 발생되는 저장 공간의 부족(예: "ENOMEM(out of memory)")에 따른 실패를 나타낼 수 있다. 상기 제2 실패는 예를 들어, JVM 힙 영역의 저장 공간의 부족(예: "JVM OOM(out of memory)")에 따른 실패를 나타낼 수 있다.The first failure may indicate a failure due to, for example, a lack of storage space (e.g., "ENOMEM (out of memory)"), which occurs when using a function that performs a memory mapping function for a file (e.g., the mmap() function). The second failure may indicate a failure due to, for example, a lack of storage space in a JVM heap area (e.g., "JVM OOM (out of memory)").
일 실시예에 따르면, 상기 프로세서(230)는 상기 제1 실패의 발생 시 상기 힙 영역(253)의 실제 사용량에 기반하여 상기 힙 영역(253)의 크기에 대한 변경 여부를 결정할 수 있다. 상기 프로세서(230)는 상기 힙 영역(253)의 실제 사용량이 상기 제1 실패의 발생에 따른 상기 힙 영역(253)의 크기를 감소하기 위한 단계 값보다 작으면, 상기 힙 영역(253)의 크기를 상기 단계 값으로 설정할 수 있다. 예를 들어, 상기 힙 영역(253)의 현재 크기가 상기 제3 단계 값으로 설정된 상태에서, 상기 힙 영역(253)의 실제 사용량이 상기 제2 단계 값보다 작으면, 상기 제1 실패의 발생에 따른 상기 힙 영역(253)의 크기를 상기 제2 단계 값으로 설정할 수 있다. 또 다른 예를 들어, 상기 힙 영역(253)의 현재 크기가 상기 제3 단계 값으로 설정된 상태에서, 상기 힙 영역(253)의 실제 사용량이 상기 제1 단계 값보다 작으면, 상기 제1 실패의 발생에 따른 상기 힙 영역(253)의 크기를 상기 제2 단계 값 또는 상기 제1 단계 값으로 설정할 수 있다.According to one embodiment, the processor (230) may determine whether to change the size of the heap area (253) based on the actual usage of the heap area (253) when the first failure occurs. If the actual usage of the heap area (253) is less than a step value for reducing the size of the heap area (253) when the first failure occurs, the processor (230) may set the size of the heap area (253) to the step value. For example, if the current size of the heap area (253) is set to the third step value and the actual usage of the heap area (253) is less than the second step value, the size of the heap area (253) when the first failure occurs may be set to the second step value. For another example, if the current size of the heap area (253) is set to the third step value and the actual usage of the heap area (253) is less than the first step value, the size of the heap area (253) according to the occurrence of the first failure can be set to the second step value or the first step value.
일 실시예에 따르면, 상기 프로세서(230)는 상기 힙 영역(253)의 크기가 동일한 상태에서, 상기 제1 실패의 발생 이력과 상기 제2 실패의 발생 이력이 모두 존재하는 경우, 상기 힙 영역(253)의 크기를 변경하지 않을 수 있다. 예컨대, 상기 힙 영역(253)의 크기가 상기 제2 단계 값으로 설정된 상태에서, 상기 제1 실패 및 상기 제2 실패가 발생한 경우, 상기 프로세서(230)는 상기 힙 영역(253)의 크기를 유지시킬 수 있다.According to one embodiment, the processor (230) may not change the size of the heap area (253) when both the occurrence history of the first failure and the occurrence history of the second failure exist while the size of the heap area (253) is the same. For example, when the size of the heap area (253) is set to the second step value and the first failure and the second failure occur, the processor (230) may maintain the size of the heap area (253).
일 실시예에 따르면, 상기 프로세서(230)는 상기 힙 영역(253)의 크기가 동일하지 않은 상태에서, 상기 제1 실패의 발생 이력과 상기 제2 실패의 발생 이력이 모두 존재하는 경우, 상기 힙 영역(253)의 실제 사용량에 기반하여 상기 힙 영역(253)의 크기에 대한 변경 여부를 결정할 수 있다. 상기 프로세서(230)는 상기 제1 실패가 발생된 시점의 상기 힙 영역(253)의 크기와 상기 제2 실패가 발생된 시점의 상기 힙 영역(253)의 크기 사이에 설정 가능한 크기가 존재하는 경우, 상기 힙 영역(253)의 실제 사용량이 상기 설정 가능한 크기보다 작은지를 판단하고, 상기 힙 영역(253)의 실제 사용량이 상기 설정 가능한 크기보다 작은 경우, 상기 힙 영역(253)의 크기를 상기 설정 가능한 크기로 설정할 수 있다. 예를 들어, 상기 힙 영역(253)의 크기가 상기 제1 단계 값일 때 상기 제2 실패가 발생되었고, 상기 힙 영역(253)의 크기가 상기 제3 단계일 때 상기 제1 실패가 발생되었다면, 상기 프로세서(230)는 상기 힙 영역(253)의 실제 사용량이 상기 제1 단계 값과 상기 제3 단계 값의 사이 값이 상기 제2 단계 값보다 작은지를 확인하고, 상기 힙 영역(253)의 실제 사용량이 상기 제2 단계 값보다 작은 경우, 상기 힙 영역(253)의 크기를 상기 제2 단계 값으로 설정할 수 있다. 또 다른 예를 들어, 상기 힙 영역(253)의 크기가 상기 제1 단계 값일 때 상기 제2 실패가 발생되었고, 상기 힙 영역(253)의 크기가 상기 제2 단계일 때 상기 제1 실패가 발생되었다면, 상기 제1 단계 값과 상기 제2 단계 값 사이에 설정 가능한 단계 값이 존재하지 않기 때문에, 상기 프로세서(230)는 상기 힙 영역(253)의 실제 사용량을 고려하여, 상기 힙 영역(253)의 크기를 상기 제2 단계 값으로 설정할 수 있다.According to one embodiment, when the sizes of the heap areas (253) are not the same, and both a history of the first failure and a history of the second failure exist, the processor (230) may determine whether to change the size of the heap area (253) based on the actual usage of the heap area (253). When a settable size exists between the size of the heap area (253) at the time when the first failure occurred and the size of the heap area (253) at the time when the second failure occurred, the processor (230) may determine whether the actual usage of the heap area (253) is smaller than the settable size, and when the actual usage of the heap area (253) is smaller than the settable size, the size of the heap area (253) may be set to the settable size. For example, if the second failure occurs when the size of the heap area (253) is the first step value, and if the first failure occurs when the size of the heap area (253) is the third step, the processor (230) can check whether the actual usage of the heap area (253) is a value between the first step value and the third step value that is smaller than the second step value, and if the actual usage of the heap area (253) is smaller than the second step value, the size of the heap area (253) can be set to the second step value. For another example, if the second failure occurred when the size of the heap area (253) is the first step value, and the first failure occurred when the size of the heap area (253) is the second step, since there is no step value that can be set between the first step value and the second step value, the processor (230) can set the size of the heap area (253) to the second step value by considering the actual usage of the heap area (253).
상술한 설명에서, 상기 힙 영역(253)의 크기가 지정된 개수로 구분된 크기 범위들을 나타내는 단계 값으로 설정되는 경우에 대해 설명하였지만, 이에 한정되는 것은 아니다. 다양한 실시예에 따르면, 상기 프로세서(230)는 상기 힙 영역(253)의 크기를 상기 힙 영역(253)의 실제 사용량보다 지정된 크기 이상 큰 값으로 설정할 수도 있다. 이 경우, 상기 프로세서(230)는 상기 메모리(210)의 단위 처리량(예: 페이지 크기)에 대응되는 크기로 상기 힙 영역(253)의 크기를 설정할 수 있다.In the above description, the case where the size of the heap area (253) is set to a step value representing a size range divided by a specified number has been described, but it is not limited thereto. According to various embodiments, the processor (230) may set the size of the heap area (253) to a value that is larger than the actual usage of the heap area (253) by a specified size or more. In this case, the processor (230) may set the size of the heap area (253) to a size corresponding to the unit processing amount (e.g., page size) of the memory (210).
일 실시예에 따르면, 상기 힙 영역(253)의 크기는 실제 사용량에 기반하여 계산된 메모리의 크기 값(예: 0~1GB)일 수 있다. 예를 들어, 상기 힙 영역(253)의 크기는 실제 사용량 또는 실제 사용량에 마진(margin)값(예: 지정된 크기 값 또는 현재 할당된 힙 영역(253)의 크기에 지정된 비율을 곱한 값)을 더하여 계산된 크기일 수 있다.According to one embodiment, the size of the heap area (253) may be a memory size value (e.g., 0 to 1 GB) calculated based on actual usage. For example, the size of the heap area (253) may be a size calculated by adding a margin value (e.g., a specified size value or a value obtained by multiplying the size of the currently allocated heap area (253) by a specified ratio) to the actual usage or the actual usage.
일 실시예에 따르면, 상기 메모리 할당의 실패가 상기 가상 메모리(250)에 포함된 영역들 중 상기 힙 영역(253) 이외의 영역에 대한 저장 공간의 부족 시 발생되는 제1 실패인 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 지정되거나 계산된 크기만큼 작은 값으로 설정하도록 하는 정보를 기록할 수 있다. 예를 들어, 상기 힙 영역(253)의 현재의 크기가 제1 설정 값으로 설정된 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 상기 제1 설정 값보다 작은 제2 설정 값으로 설정하도록 하는 정보를 기록할 수 있다. According to one embodiment, if the failure of the memory allocation is a first failure that occurs when there is insufficient storage space for an area other than the heap area (253) among the areas included in the virtual memory (250), the processor (230) may record information in the profile to set the size of the heap area (253) to a value smaller by a specified or calculated size. For example, if the current size of the heap area (253) is set to a first set value, the processor (230) may record information in the profile to set the size of the heap area (253) to a second set value smaller than the first set value.
일 실시예에 따르면, 상기 메모리 할당의 실패가 상기 가상 메모리(250)에 포함된 영역들 중 상기 힙 영역(253)에 대한 저장 공간의 부족 시 발생되는 제2 실패인 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 지정되거나 계산된 크기만큼 큰 값으로 설정하도록 하는 정보를 기록할 수 있다. 예를 들어, 상기 힙 영역(253)의 현재의 크기가 제1 설정 값으로 설정된 경우, 상기 프로세서(230)는 상기 프로파일에 상기 힙 영역(253)의 크기를 상기 제1 설정 값보다 큰 제2 설정 값으로 설정하도록 하는 정보를 기록할 수 있다. According to one embodiment, if the failure of the memory allocation is a second failure that occurs when there is insufficient storage space for the heap area (253) among the areas included in the virtual memory (250), the processor (230) may record information in the profile to set the size of the heap area (253) to a value that is larger than the specified or calculated size. For example, if the current size of the heap area (253) is set to a first set value, the processor (230) may record information in the profile to set the size of the heap area (253) to a second set value that is larger than the first set value.
일 실시예에 따르면, 상기 프로세서(230)는 상기 제1 실패의 발생 시, 상기 어플리케이션(211)의 실행과 관련된 프로세스로 상기 제1 실패의 발생을 나타내는 신호를 전송할 수 있다. 일 실시예에 따르면, 상기 신호는 상기 프로세스의 내부 동작 중 독립적으로 수행가능한 SW 모듈의 결과값(예: 실패 또는 성공의 결과값)을 포함할 수 있다. 상기 SW 모듈은 힙 영역을 설정하는 기능을 수행하는 모듈일 수 있다. 상기 제1 실패의 경우, 한 번 발생될 때 이어서 여러 번 동일한 종류의 실패(제1 실패)가 발생될 수 있기 때문에, 상기 프로세서(230)는 상기 신호를 전송한 후, 지정된 횟수(예: 50회)의 동일한 종류의 다른 제1 실패들이 발생되면, 상기 다른 제1 실패들의 발생을 나타내는 신호들이 상기 프로세스로 전송되지 않도록 제어할 수 있다. 또한, 상기 프로세서(230)는 상기 지정된 횟수의 다른 제1 실패들이 발생된 후, 또 다른 제1 실패가 발생되면, 새롭게 발생된 상기 또 다른 제1 실패의 발생을 나타내는 신호를 상기 프로세스로 전송할 수 있다. 일 실시예에 따르면, 상기 프로세서(230)는 상기 프로세스로 전송된 상기 제1 실패의 발생을 나타내는 신호의 개수에 대한 정보를 상기 프로파일에 포함시킬 수 있다. 예컨대, 상기 프로세서(230)는 상기 제1 실패의 발생을 나타내는 신호의 개수를 상기 프로파일에 기록할 수 있다.According to one embodiment, when the first failure occurs, the processor (230) may transmit a signal indicating the occurrence of the first failure to a process related to the execution of the application (211). According to one embodiment, the signal may include a result value (e.g., a result value of failure or success) of an independently executable SW module among the internal operations of the process. The SW module may be a module that performs a function of setting a heap area. In the case of the first failure, since the same type of failure (the first failure) may occur multiple times after it occurs once, the processor (230) may control, after transmitting the signal, so that if a specified number of (e.g., 50) other first failures of the same type occur, signals indicating the occurrence of the other first failures are not transmitted to the process. In addition, if another first failure occurs after the specified number of other first failures occur, the processor (230) may transmit a signal indicating the occurrence of the newly occurred other first failure to the process. In one embodiment, the processor (230) may include information about the number of signals indicating the occurrence of the first failure transmitted to the process in the profile. For example, the processor (230) may record the number of signals indicating the occurrence of the first failure in the profile.
일 실시예에 따르면, 상기 프로세서(230)는 상기 프로파일에 포함된 상기 제1 실패의 발생을 나타내는 신호의 개수가 지정된 값(예: 3회)을 초과하면, 상기 힙 영역(253)의 크기에 대한 변경 여부를 결정할 수 있다. 예컨대, 상기 프로세서(230)는 상기 제1 실패의 발생을 나타내는 신호의 개수가 상기 지정된 값을 초과하면, 상기 힙 영역(253)의 실제 사용량 및 상기 제2 실패의 발생 이력에 기반하여, 상기 힙 영역(253)의 크기에 대한 변경 여부를 결정할 수 있다.According to one embodiment, the processor (230) may determine whether to change the size of the heap area (253) if the number of signals indicating the occurrence of the first failure included in the profile exceeds a specified value (e.g., 3 times). For example, the processor (230) may determine whether to change the size of the heap area (253) based on the actual usage of the heap area (253) and the occurrence history of the second failure if the number of signals indicating the occurrence of the first failure exceeds the specified value.
일 실시예에 따르면, 상기 프로파일에 포함되는 정보 즉, 상기 프로파일에 기록되는 정보는 상기 힙 영역(253)의 크기에 대한 변경 여부에 관한 정보(예: 크기 유지, 크기 감소 및 크기 증가 중 하나를 나타내는 값), 상기 힙 영역(253)의 크기 변경 값(예: 변경할 단계 값 또는 변경할 크기 값), 상기 힙 영역(253)의 실제 사용량, 상기 제1 실패의 발생을 나타내는 신호의 개수, 및 상기 제2 실패의 발생 횟수 중 적어도 하나를 포함할 수 있다.According to one embodiment, the information included in the profile, that is, the information recorded in the profile, may include at least one of information on whether the size of the heap area (253) has changed (e.g., a value indicating one of size maintenance, size reduction, and size increase), a size change value of the heap area (253) (e.g., a step value to be changed or a size value to be changed), an actual usage amount of the heap area (253), the number of signals indicating the occurrence of the first failure, and the number of occurrences of the second failure.
상술한 바와 같이, 다양한 실시예에 따르면, 전자 장치(예: 도 2의 전자 장치(200))는, 어플리케이션(예: 도 2의 어플리케이션(211))을 저장하는 메모리(예: 도 2의 메모리(210)), 및 상기 메모리와 작동적으로 연결된 프로세서(예: 도 2의 프로세서(230))를 포함하고, 상기 프로세서는, 상기 어플리케이션의 실행 중 상기 어플리케이션에 대응되는 가상 메모리(예: 도 2의 가상 메모리(250))에 대한 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하고, 상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 힙 영역(예: 도 2의 힙 영역(253))의 크기를 결정하고, 상기 결정된 크기의 힙 영역을 포함하는 상기 가상 메모리를 할당하도록 설정될 수 있다.As described above, according to various embodiments, an electronic device (e.g., the electronic device (200) of FIG. 2) may include a memory (e.g., the memory (210) of FIG. 2) that stores an application (e.g., the application (211) of FIG. 2), and a processor (e.g., the processor (230) of FIG. 2) operatively connected to the memory, wherein the processor may be configured to, when memory allocation for a virtual memory (e.g., the virtual memory (250) of FIG. 2) corresponding to the application fails during execution of the application, set information indicating a failure of the memory allocation, and, when the application is re-executed, if the set information exists, determine the size of a heap area (e.g., the heap area (253) of FIG. 2) included in the virtual memory based on the set information, and allocate the virtual memory including the heap area having the determined size.
다양한 실시예에 따르면, 상기 프로세서는, 상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 어플리케이션의 설정 파일에 기재된 상기 힙 영역의 크기 속성의 설정 값을 무시하도록 설정될 수 있다.According to various embodiments, the processor may be configured to ignore the set value of the size attribute of the heap area described in the configuration file of the application when the application is re-executed, if the set information exists.
다양한 실시예에 따르면, 상기 프로세서는, 상기 어플리케이션의 실행에 따른 상기 힙 영역의 실제 사용량을 상기 설정된 정보에 포함시키고, 상기 힙 영역의 실제 사용량에 기반하여 상기 힙 영역의 크기를 결정하도록 설정될 수 있다.According to various embodiments, the processor may be configured to include actual usage of the heap area according to execution of the application in the set information, and determine the size of the heap area based on the actual usage of the heap area.
다양한 실시예에 따르면, 상기 힙 영역의 크기는 지정된 개수로 구분된 크기 범위들을 나타내는 단계 값으로 설정되고, 상기 프로세서는, 상기 크기 범위들 중 상기 힙 영역의 실제 사용량이 포함되는 크기 범위를 나타내는 단계 값으로 상기 힙 영역의 크기를 설정할 수 있다.According to various embodiments, the size of the heap area is set to a step value representing a size range divided by a specified number, and the processor can set the size of the heap area to a step value representing a size range within which an actual usage of the heap area is included among the size ranges.
다양한 실시예에 따르면, 상기 메모리 할당의 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족 시 발생되는 제1 실패를 포함할 수 있다.According to various embodiments, the failure of the memory allocation may include a first failure that occurs when there is insufficient storage space for an area other than the heap area among the areas included in the virtual memory.
다양한 실시예에 따르면, 상기 프로세서는, 상기 제1 실패의 발생 시, 상기 설정된 정보에 상기 힙 영역의 크기를 줄이기 위한 정보를 포함시키도록 설정될 수 있다.According to various embodiments, the processor may be configured to include information for reducing the size of the heap area in the set information when the first failure occurs.
다양한 실시예에 따르면, 상기 프로세서는, 상기 제1 실패의 발생 시, 상기 어플리케이션의 실행과 관련된 프로세스로 상기 제1 실패의 발생을 나타내는 신호를 전송하도록 설정될 수 있다.According to various embodiments, the processor may be configured to, upon occurrence of the first failure, transmit a signal indicating occurrence of the first failure to a process associated with execution of the application.
다양한 실시예에 따르면, 상기 프로세서는, 상기 신호의 전송 후, 지정된 횟수의 다른 제1 실패들이 발생되면, 상기 다른 제1 실패들의 발생을 나타내는 신호들을 상기 프로세스로 전송하지 않도록 제어하고, 상기 다른 제1 실패들의 발생 후, 또 다른 제1 실패가 발생되면, 상기 또 다른 제1 실패의 발생을 나타내는 신호를 상기 프로세스로 전송하고, 상기 프로세스가 수신한 상기 신호의 개수가 지정된 값을 초과하면, 상기 힙 영역의 크기에 대한 변경 여부를 결정하도록 설정될 수 있다.According to various embodiments, the processor may be configured to control not to transmit signals indicating occurrence of other first failures to the process if a specified number of other first failures occur after the transmission of the signal, to transmit a signal indicating occurrence of other first failures to the process if another first failure occurs after the occurrence of the other first failures, and to determine whether to change the size of the heap area if the number of the signals received by the process exceeds a specified value.
다양한 실시예에 따르면, 상기 메모리 할당의 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족 시 발생되는 제2 실패를 포함할 수 있다.According to various embodiments, the failure of said memory allocation may include a second failure that occurs when there is insufficient storage space for said heap area among the areas included in said virtual memory.
다양한 실시예에 따르면, 상기 프로세서는, 상기 제2 실패의 발생 시, 상기 설정된 정보에 상기 힙 영역의 크기를 늘리기 위한 정보를 포함시키도록 설정될 수 있다.According to various embodiments, the processor may be configured to include information for increasing the size of the heap region in the set information when the second failure occurs.
도 3은 본 발명의 일 실시예에 따른 가상 메모리에 대한 메모리 할당의 실패를 처리하는 방법을 설명하기 위한 도면이다.FIG. 3 is a diagram for explaining a method for handling a failure in memory allocation for virtual memory according to one embodiment of the present invention.
도 3을 참조하면, 전자 장치(예: 도 2의 전자 장치(200))의 프로세서(예: 도 2의 프로세서(230))는 동작 310에서, 가상 메모리(예: 도 2의 가상 메모리(250))에 대한 메모리 할당이 실패했는지를 판단할 수 있다. 상기 가상 메모리에 대한 메모리 할당의 실패는 예를 들어, 파일에 대한 메모리 매핑 기능을 수행하는 함수(예: mmap())의 사용 시 발생되는 저장 공간의 부족에 따른 제1 실패, 및 JVM 힙 영역의 저장 공간의 부족에 따른 제2 실패를 포함할 수 있다. 상기 제1 실패 및 상기 제2 실패는 시스템 이벤트의 형태로 발생될 수 있다. 상기 제1 실패는 예를 들어, mmap() 함수의 호출 결과로 실패 값(예: "MAP_FAILED")이 리턴되고, 실패에 대한 식별 값(예: "errno")이 저장 공간의 부족을 나타내는 값(예: "ENOMEM(out of memory)")을 포함하는 상태를 나타낼 수 있다. 또한, 상기 제2 실패는 예를 들어, JVM 힙 영역의 저장 공간의 부족을 나타내는 이벤트(예: "JVM OOM(out of memory)")가 발생된 상태를 나타낼 수 있다. 예를 들어, 상기 제2 실패는 어플리케이션(211) 실행 시 또는 실행 중에 자바 오브젝트(java object)가 힙 영역의 저장 공간 부족으로 상기 힙 영역에 할당되지 못하는 경우, 이벤트(예: “OOM(out of memory)”)가 발생된 상태를 나타낼 수 있다. 즉, 상기 제1 실패는 상기 가상 메모리에 포함된 영역들 중 힙 영역(예: 도 2의 힙 영역(253)) 이외의 영역에 대한 저장 공간의 부족 시 발생될 수 있고, 상기 제2 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족 시 발생될 수 있다.Referring to FIG. 3, a processor (e.g., a processor (230) of FIG. 2) of an electronic device (e.g., an electronic device (200) of FIG. 2) may determine, in operation 310, whether memory allocation for a virtual memory (e.g., a virtual memory (250) of FIG. 2) has failed. The failure of the memory allocation for the virtual memory may include, for example, a first failure due to insufficient storage space that occurs when a function (e.g., mmap()) that performs a memory mapping function for a file is used, and a second failure due to insufficient storage space in a JVM heap area. The first failure and the second failure may occur in the form of a system event. The first failure may indicate, for example, a state in which a failure value (e.g., "MAP_FAILED") is returned as a result of calling the mmap() function, and an identification value for the failure (e.g., "errno") includes a value indicating insufficient storage space (e.g., "ENOMEM (out of memory)"). In addition, the second failure may indicate a state in which an event (e.g., “JVM OOM (out of memory)”) indicating a shortage of storage space in a JVM heap area has occurred. For example, the second failure may indicate a state in which an event (e.g., “OOM (out of memory)”) has occurred when a Java object cannot be allocated to a heap area due to a shortage of storage space in the heap area when the application (211) is executed or during execution. That is, the first failure may occur when there is a shortage of storage space for an area other than a heap area (e.g., the heap area (253) of FIG. 2) among the areas included in the virtual memory, and the second failure may occur when there is a shortage of storage space for the heap area among the areas included in the virtual memory.
상기 가상 메모리에 대한 메모리 할당이 실패했다고 판단되면, 상기 프로세서는 동작 330에서, 상기 가상 메모리에 대한 메모리 할당의 실패를 나타내는 정보(이하, 프로파일이라 한다)를 설정할 수 있다. 또한, 상기 프로세서는 설정된 프로파일을 메모리(예: 도 2의 메모리(210))에 저장할 수 있다. 일 실시예에 따르면, 상기 프로파일이 상기 메모리에 저장되어 있지 않은 경우, 상기 프로세서는 상기 프로파일을 새로 생성할 수 있고, 상기 프로파일이 상기 메모리에 저장되어 있는 경우, 상기 프로세서는 상기 저장된 프로파일을 수정(또는 변경)할 수 있다. 일 실시예에 따르면, 상기 프로파일은 상기 메모리에 파일 형태로 저장될 수 있다.If it is determined that the memory allocation for the virtual memory has failed, the processor may set information (hereinafter, referred to as a profile) indicating the failure of the memory allocation for the virtual memory at operation 330. In addition, the processor may store the set profile in a memory (e.g., the memory (210) of FIG. 2). According to one embodiment, if the profile is not stored in the memory, the processor may create a new profile, and if the profile is stored in the memory, the processor may modify (or change) the stored profile. According to one embodiment, the profile may be stored in the memory in the form of a file.
일 실시예에 따르면, 상기 프로파일에 포함되는 정보 즉, 상기 프로파일에 기록되는 정보는 상기 가상 메모리에 포함된 힙 영역(예: 도 2의 힙 영역(253))의 크기에 대한 변경 여부에 관한 정보(예: 크기 유지, 크기 감소 및 크기 증가 중 하나를 나타내는 값), 상기 힙 영역의 크기 변경 값(예: 변경할 단계 값 또는 변경할 크기 값), 상기 힙 영역의 실제 사용량, 상기 제1 실패의 발생을 나타내는 신호의 개수, 및 상기 제2 실패의 발생 횟수 중 적어도 하나를 포함할 수 있다.According to one embodiment, the information included in the profile, that is, the information recorded in the profile, may include at least one of information on whether the size of a heap area included in the virtual memory (e.g., the heap area (253) of FIG. 2) has changed (e.g., a value indicating one of size maintenance, size reduction, and size increase), a size change value of the heap area (e.g., a step value to be changed or a size value to be changed), an actual usage amount of the heap area, a number of signals indicating the occurrence of the first failure, and the number of occurrences of the second failure.
일 실시예에 따르면, 상기 프로세서는 상기 메모리 할당이 실패하면, 어플리케이션(예: 도 2의 어플리케이션(211))의 실행에 따른 상기 힙 영역의 실제 사용량을 상기 프로파일에 포함시킬 수 있다. 예컨대, 상기 프로세서는 상기 힙 영역의 실제 사용량을 상기 프로파일에 기록할 수 있다.According to one embodiment, if the memory allocation fails, the processor may include the actual usage of the heap area according to the execution of an application (e.g., application (211) of FIG. 2) in the profile. For example, the processor may record the actual usage of the heap area in the profile.
일 실시예에 따르면, 상기 프로세서는 상기 메모리 할당의 실패가 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족 시 발생되는 제1 실패인 경우, 상기 프로파일에 상기 힙 영역의 크기를 줄이기 위한 정보를 포함시킬 수 있다. 예를 들어, 상기 프로세서는 상기 프로파일에 상기 힙 영역의 크기를 적어도 한 단계 낮은 값으로 설정하도록 하는 정보를 기록할 수 있다. 이 경우, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 감소를 나타내는 값으로 설정할 수 있다.According to one embodiment, if the failure of the memory allocation is a first failure that occurs when there is insufficient storage space for an area other than the heap area among the areas included in the virtual memory, the processor may include information for reducing the size of the heap area in the profile. For example, the processor may record information for setting the size of the heap area to a value at least one level lower in the profile. In this case, the processor may set the information regarding whether the size of the heap area included in the profile is changed to a value indicating a size reduction.
일 실시예에 따르면, 상기 프로세서는 상기 메모리 할당의 실패가 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족 시 발생되는 제2 실패인 경우, 상기 프로파일에 상기 힙 영역의 크기를 늘리기 위한 정보를 포함시킬 수 있다. 예를 들어, 상기 프로세서는 상기 프로파일에 상기 힙 영역의 크기를 적어도 한 단계 높은 값으로 설정하도록 하는 정보를 기록할 수 있다. 이 경우, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 증가를 나타내는 값으로 설정할 수 있다.According to one embodiment, if the failure of the memory allocation is a second failure that occurs when there is insufficient storage space for the heap area among the areas included in the virtual memory, the processor may include information for increasing the size of the heap area in the profile. For example, the processor may record information for setting the size of the heap area to a value at least one level higher in the profile. In this case, the processor may set the information regarding whether the size of the heap area included in the profile is changed to a value indicating a size increase.
일 실시예에 따르면, 상기 프로세서는 상기 제1 실패의 발생 시 상기 힙 영역의 실제 사용량에 기반하여 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값을 설정할 수 있다. 예를 들어, 상기 프로세서는 상기 힙 영역의 실제 사용량이 상기 제1 실패의 발생에 따른 상기 힙 영역의 크기를 감소하기 위한 단계 값보다 작으면, 상기 힙 영역의 크기를 상기 단계 값으로 설정할 수 있다. 이 경우, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 감소를 나타내는 값으로 설정할 수 있다.According to one embodiment, the processor may set a size change value of the heap area included in the profile based on the actual usage of the heap area when the first failure occurs. For example, if the actual usage of the heap area is less than a step value for reducing the size of the heap area when the first failure occurs, the processor may set the size of the heap area to the step value. In this case, the processor may set the information on whether to change the size of the heap area included in the profile to a value indicating a size reduction.
일 실시예에 따르면, 상기 프로세서는 상기 힙 영역의 크기가 동일한 상태에서, 상기 제1 실패의 발생 이력과 상기 제2 실패의 발생 이력이 모두 존재하는 경우, 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값을 제로(zero)로 설정하거나 삭제할 수 있다. 예컨대, 상기 프로세서는 상기 힙 영역의 크기가 동일한 상태에서, 상기 제1 실패 및 상기 제2 실패가 모두 발생한 경우, 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 유지를 나타내는 값으로 설정할 수 있다.According to one embodiment, when the size of the heap area is the same and both the occurrence history of the first failure and the occurrence history of the second failure exist, the processor may set the change value of the size of the heap area included in the profile to zero or delete it. For example, when the size of the heap area is the same and both the first failure and the second failure occur, the processor may set the information on whether the size of the heap area included in the profile has been changed to a value indicating size maintenance.
일 실시예에 따르면, 상기 프로세서는 상기 힙 영역의 크기가 동일하지 않은 상태에서, 상기 제1 실패의 발생 이력과 상기 제2 실패의 발생 이력이 모두 존재하는 경우, 상기 힙 영역의 실제 사용량에 기반하여 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 설정할 수 있다. 예를 들어, 상기 프로세서는 상기 제1 실패가 발생된 시점의 상기 힙 영역의 크기와 상기 제2 실패가 발생된 시점의 상기 힙 영역의 크기 사이에 설정 가능한 크기가 존재하는 경우, 상기 힙 영역의 실제 사용량이 상기 설정 가능한 크기보다 작은지를 판단하고, 상기 힙 영역의 실제 사용량이 상기 설정 가능한 크기보다 작은 경우, 상기 힙 영역의 크기를 상기 설정 가능한 크기로 설정할 수 있다. 이 경우, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 증가를 나타내는 값으로 설정할 수 있다. 다른 예를 들어, 상기 프로세서는 상기 제1 실패가 발생된 시점의 상기 힙 영역의 크기와 상기 제2 실패가 발생된 시점의 상기 힙 영역의 크기 사이에 설정 가능한 크기가 존재하지 않는 경우, 상기 힙 영역의 실제 사용량을 고려하여, 상기 힙 영역의 크기를 기존의 힙 영역의 크기보다 큰 값으로 설정할 수 있다. 이 경우도, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 증가를 나타내는 값으로 설정할 수 있다.According to one embodiment, when the sizes of the heap areas are not the same, and both a history of the first failure and a history of the second failure exist, the processor may set information on whether the size of the heap area has changed based on the actual usage of the heap area. For example, when a configurable size exists between the size of the heap area at the time when the first failure occurred and the size of the heap area at the time when the second failure occurred, the processor may determine whether the actual usage of the heap area is smaller than the configurable size, and if the actual usage of the heap area is smaller than the configurable size, the processor may set the size of the heap area to the configurable size. In this case, the processor may set the information on whether the size of the heap area included in the profile has changed to a value indicating a size increase. For another example, if there is no settable size between the size of the heap area at the time when the first failure occurred and the size of the heap area at the time when the second failure occurred, the processor may set the size of the heap area to a value larger than the size of the existing heap area, taking into account the actual usage of the heap area. In this case as well, the processor may set the information on whether the size of the heap area included in the profile has been changed to a value indicating a size increase.
일 실시예에 따르면, 상기 프로세서는 상기 제1 실패의 발생 시, 상기 어플리케이션의 실행과 관련된 프로세스로 상기 제1 실패의 발생을 나타내는 신호를 전송할 수 있고, 상기 신호를 전송한 후, 지정된 횟수의 동일한 종류의 다른 제1 실패들이 발생되면, 상기 다른 제1 실패들의 발생을 나타내는 신호들이 상기 프로세스로 전송되지 않도록 제어할 수 있다. 또한, 상기 프로세서는 상기 지정된 횟수의 다른 제1 실패들이 발생된 후, 또 다른 제1 실패가 발생되면, 새롭게 발생된 상기 또 다른 제1 실패의 발생을 나타내는 신호를 상기 프로세스로 전송할 수 있다. 이때, 상기 프로세서는 상기 프로세스로 전송된 상기 제1 실패의 발생을 나타내는 신호의 개수에 대한 정보를 상기 프로파일에 포함시킬 수 있다. 예컨대, 상기 프로세서는 상기 제1 실패의 발생을 나타내는 신호의 개수를 상기 프로파일에 기록할 수 있다. 또한, 상기 프로세서는 상기 프로파일에 포함된 상기 제1 실패의 발생을 나타내는 신호의 개수가 지정된 값을 초과하면, 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 감소를 나타내는 값으로 설정할 수 있다.According to one embodiment, when the first failure occurs, the processor may transmit a signal indicating the occurrence of the first failure to a process related to the execution of the application, and after transmitting the signal, if a specified number of other first failures of the same type occur, the processor may control signals indicating the occurrence of the other first failures not to be transmitted to the process. In addition, when another first failure occurs after the specified number of other first failures occur, the processor may transmit a signal indicating the occurrence of the newly occurred other first failure to the process. At this time, the processor may include information about the number of signals indicating the occurrence of the first failure transmitted to the process in the profile. For example, the processor may record the number of signals indicating the occurrence of the first failure in the profile. In addition, when the number of signals indicating the occurrence of the first failure included in the profile exceeds a specified value, the processor may set information about whether to change the size of the heap area included in the profile to a value indicating a size reduction.
일 실시예에 따르면, 상기 프로세서는 상기 제2 실패의 발생 시, 상기 프로파일에 포함된 상기 제2 실패의 발생 횟수를 기록할 수 있다. 예컨대, 상기 프로세서는 상기 제2 실패가 발생되는 경우, 상기 프로파일에 포함된 상기 제2 실패의 발생 횟수를 증가시킬 수 있다.In one embodiment, the processor may record the number of occurrences of the second failure included in the profile when the second failure occurs. For example, the processor may increase the number of occurrences of the second failure included in the profile when the second failure occurs.
도 4는 본 발명의 일 실시예에 따른 가상 메모리의 할당 방법을 설명하기 위한 도면이다.FIG. 4 is a drawing for explaining a method for allocating virtual memory according to one embodiment of the present invention.
도 4를 참조하면, 전자 장치(예: 도 2의 전자 장치(200))의 프로세서(예: 도 2의 프로세서(230))는 동작 410에서, 가상 메모리(예: 도 2의 가상 메모리(250))에 대한 메모리 할당의 실패를 나타내는 정보(이하, 프로파일이라 한다)가 존재하는지를 판단할 수 있다. 예를 들어, 상기 프로세서는 메모리(예: 도 2의 메모리(210))에 저장된 어플리케이션(예: 도 2의 어플리케이션(211))의 실행 시, 상기 메모리에 저장된 프로파일이 존재하는지를 판단할 수 있다.Referring to FIG. 4, a processor (e.g., a processor (230) of FIG. 2) of an electronic device (e.g., an electronic device (200) of FIG. 2) may determine, at operation 410, whether there is information (hereinafter, referred to as a profile) indicating a failure in memory allocation for a virtual memory (e.g., a virtual memory (250) of FIG. 2). For example, the processor may determine, when executing an application (e.g., an application (211) of FIG. 2) stored in a memory (e.g., a memory (210) of FIG. 2), whether there is a profile stored in the memory.
상기 프로파일이 존재하지 않는다고 판단된 경우, 상기 프로세서는 동작 430에서, 상기 어플리케이션의 설정 파일(예: 상기 어플리케이션의 패키지에 포함된 "AndroidManifest.xml" 파일)에 기반하여 힙 영역(예: 도 2의 힙 영역(253))의 크기를 결정할 수 있다. 예를 들어, 상기 프로세서는 상기 어플리케이션의 설정 파일에 기재된 힙 영역의 크기 속성(예: "largeHeap"으로 정의되는 속성)의 설정 값(예: "true" 또는 "false"(default 값))에 따라 상기 어플리케이션에 대응되는 가상 메모리의 힙 영역의 크기를 결정할 수 있다. 일 예로, 상기 힙 영역의 크기 속성의 설정 값이 "true"로 설정된 경우, 상기 프로세서는 상기 힙 영역 중 JVM 힙 영역을 최대로 사용 가능한 크기(예: 1GB)로 할당할 수 있다.If it is determined that the above profile does not exist, the processor may determine the size of a heap area (e.g., the heap area (253) of FIG. 2) based on a configuration file of the application (e.g., an "AndroidManifest.xml" file included in a package of the application) at operation 430. For example, the processor may determine the size of a heap area of a virtual memory corresponding to the application based on a setting value (e.g., "true" or "false" (default value)) of a size attribute of the heap area (e.g., an attribute defined as "largeHeap") described in the configuration file of the application. For example, if the setting value of the size attribute of the heap area is set to "true", the processor may allocate a JVM heap area among the heap areas to a maximum available size (e.g., 1 GB).
상기 프로파일이 존재한다고 판단된 경우, 상기 프로세서는 동작 450에서, 상기 프로파일에 기반하여 상기 힙 영역의 크기를 결정할 수 있다. 일 실시예에 따르면, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 실제 사용량에 기반하여 상기 힙 영역의 크기를 결정할 수 있다. 예를 들어, 상기 프로세서는 상기 힙 영역의 실제 사용량보다 지정된 크기 이상으로 큰 값으로 상기 힙 영역의 크기를 결정할 수 있다. 일 실시예에 따르면, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값에 기반하여 상기 힙 영역의 크기를 결정할 수 있다. 예를 들어, 상기 프로세서는 상기 힙 영역의 크기 변경 값으로 상기 힙 영역의 크기를 결정할 수 있다. 여기서, 상기 힙 영역의 크기 변경 값은 상기 힙 영역의 실제 사용량보다 지정된 크기 이상으로 큰 값으로 설정된 값, 또는 상기 힙 영역의 크기를 지정된 개수로 구분한 크기 범위들을 나타내는 단계 값들(예: 제1 단계 값, 제2 단계 값, 또는 제3 단계 값) 중 하나의 단계 값을 포함할 수 있다.If it is determined that the profile exists, the processor may determine the size of the heap area based on the profile at operation 450. According to one embodiment, the processor may determine the size of the heap area based on the actual usage of the heap area included in the profile. For example, the processor may determine the size of the heap area to be a value that is larger than a specified size or more than the actual usage of the heap area. According to one embodiment, the processor may determine the size of the heap area based on a size change value of the heap area included in the profile. For example, the processor may determine the size of the heap area as the size change value of the heap area. Here, the size change value of the heap area may include a value set to a value that is larger than a specified size or more than the actual usage of the heap area, or one of step values (e.g., a first step value, a second step value, or a third step value) representing size ranges in which the size of the heap area is divided into a specified number of step values.
일 실시예에 따르면, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보가 크기 유지를 나타내는 값으로 설정된 경우, 상기 힙 영역의 크기를 유지시킬 수 있다. 다른 실시예에 따르면, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보가 크기 감소를 나타내는 값으로 설정된 경우, 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값으로 상기 힙 영역의 크기를 감소시킬 수 있다. 또 다른 실시예에 따르면, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보가 크기 증가를 나타내는 값으로 설정된 경우, 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값으로 상기 힙 영역의 크기를 증가시킬 수 있다.According to one embodiment, the processor can maintain the size of the heap area if the information regarding whether the size of the heap area included in the profile is set to a value indicating size maintenance. According to another embodiment, the processor can decrease the size of the heap area by a size change value of the heap area included in the profile if the information regarding whether the size of the heap area included in the profile is set to a value indicating size decrease. According to yet another embodiment, the processor can increase the size of the heap area by a size change value of the heap area included in the profile if the information regarding whether the size of the heap area included in the profile is set to a value indicating size increase.
상기 힙 영역의 크기가 결정되면, 상기 프로세서는 동작 470에서, 상기 결정된 크기의 힙 영역을 포함하는 상기 가상 메모리를 설정(또는 할당)할 수 있다.Once the size of the heap area is determined, the processor can set (or allocate) the virtual memory including the heap area of the determined size at operation 470.
도 5는 본 발명의 일 실시예에 따른 가상 메모리에 대한 메모리 할당의 실패와 관련된 정보를 설정하는 방법을 설명하기 위한 도면이다.FIG. 5 is a diagram for explaining a method for setting information related to a failure in memory allocation for virtual memory according to one embodiment of the present invention.
도 5를 참조하면, 전자 장치(예: 도 2의 전자 장치(200))의 프로세서(예: 도 2의 프로세서(230))는 가상 메모리(예: 도 2의 가상 메모리(250))에 대한 메모리 할당의 실패의 종류에 따라 상기 가상 메모리에 포함된 힙 영역(예: 도 2의 힙 영역(253))의 크기를 증가 또는 감소시킬 수 있다. 상기 가상 메모리에 대한 메모리 할당의 실패는 예를 들어, 파일에 대한 메모리 매핑 기능을 수행하는 함수의 사용 시 발생되는 저장 공간의 부족에 따른 제1 실패, 및 JVM 힙 영역의 저장 공간의 부족에 따른 제2 실패를 포함할 수 있다. 상기 제1 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족 시 발생될 수 있고, 상기 제2 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족 시 발생될 수 있다.Referring to FIG. 5, a processor (e.g., a processor (230) of FIG. 2) of an electronic device (e.g., an electronic device (200) of FIG. 2) may increase or decrease a size of a heap area (e.g., a heap area (253) of FIG. 2) included in a virtual memory (e.g., a virtual memory (250) of FIG. 2)) depending on a type of failure in memory allocation for the virtual memory. The failure in memory allocation for the virtual memory may include, for example, a first failure due to insufficient storage space that occurs when a function that performs a memory mapping function for a file is used, and a second failure due to insufficient storage space of a JVM heap area. The first failure may occur when there is insufficient storage space for an area other than the heap area among areas included in the virtual memory, and the second failure may occur when there is insufficient storage space for the heap area among areas included in the virtual memory.
상기 프로세서는 동작 510에서, 상기 메모리 할당의 실패가 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패(상기 제2 실패)인지를 판단할 수 있다.The above processor can determine, at operation 510, whether the failure of the memory allocation is a failure due to insufficient storage space for the heap area (the second failure).
상기 메모리 할당의 실패가 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패가 아니라고 판단된 경우 즉, 상기 메모리 할당의 실패가 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족에 따른 실패(상기 제1 실패)인 경우, 상기 프로세서는 동작 530에서, 상기 힙 영역의 크기 감소를 위한 정보를 포함하도록 상기 가상 메모리에 대한 메모리 할당의 실패를 나타내는 정보(이하, 프로파일이라 한다)를 설정할 수 있다. 예를 들어, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 감소를 나타내는 값으로 설정할 수 있다. 또한, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값을 상기 힙 영역의 현재 크기보다 작은 값으로 설정하거나, 상기 힙 영역의 현재 크기로 설정된 단계 값보다 적어도 한 단계 낮은 단계 값으로 설정할 수 있다.If it is determined that the failure of the above memory allocation is not a failure due to insufficient storage space for the heap area, that is, if the failure of the memory allocation is a failure due to insufficient storage space for an area other than the heap area (the first failure), the processor may, in operation 530, set information (hereinafter, referred to as a “profile”) indicating a failure of the memory allocation for the virtual memory to include information for reducing the size of the heap area. For example, the processor may set information regarding whether the size of the heap area included in the profile has changed to a value indicating a size reduction. In addition, the processor may set a size change value of the heap area included in the profile to a value smaller than the current size of the heap area, or to a step value at least one step lower than a step value set to the current size of the heap area.
상기 메모리 할당의 실패가 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패라고 판단된 경우 즉, 상기 메모리 할당의 실패가 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패(상기 제2 실패)인 경우, 상기 프로세서는 동작 550에서, 상기 힙 영역의 크기 증가를 위한 정보를 포함하도록 상기 프로파일을 설정할 수 있다. 예를 들어, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 증가를 나타내는 값으로 설정할 수 있다. 또한, 상기 프로세서는 상기 프로파일에 포함된 상기 힙 영역의 크기 변경 값을 상기 힙 영역의 현재 크기보다 큰 값으로 설정하거나, 상기 힙 영역의 현재 크기로 설정된 단계 값보다 적어도 한 단계 높은 단계 값으로 설정할 수 있다.If it is determined that the failure of the above memory allocation is a failure due to a lack of storage space for the heap area, that is, if the failure of the above memory allocation is a failure due to a lack of storage space for the heap area (the second failure), the processor may set the profile to include information for increasing the size of the heap area at operation 550. For example, the processor may set the information regarding whether the size of the heap area, included in the profile, has changed to a value indicating a size increase. In addition, the processor may set the size change value of the heap area, included in the profile, to a value larger than the current size of the heap area, or to a step value at least one step higher than the step value set to the current size of the heap area.
상술한 동작 510에서, 상기 프로세서가 상기 메모리 할당의 실패가 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패(상기 제2 실패)인지를 판단하는 것으로 설명하였지만, 이에 한정되는 것은 아니다. 어떤 실시예에서, 상기 프로세서는 동작 510에서, 상기 메모리 할당의 실패가 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족에 따른 실패(상기 제1 실패)인지를 판단할 수 있다. 이 경우에도 마찬가지로, 상기 프로세서는 상기 메모리 할당의 실패가 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족에 따른 실패라고 판단되면 동작 530을 수행할 수 있고, 상기 메모리 할당의 실패가 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족에 따른 실패가 아니라고 판단되면 동작 550을 수행할 수 있다.Although the processor in the above-described operation 510 has been described as determining whether the failure of the memory allocation is a failure due to a lack of storage space for the heap area (the second failure), it is not limited thereto. In some embodiments, the processor in the operation 510 may determine whether the failure of the memory allocation is a failure due to a lack of storage space for an area other than the heap area (the first failure). In this case as well, if the processor determines that the failure of the memory allocation is a failure due to a lack of storage space for an area other than the heap area, the processor may perform operation 530, and if the processor determines that the failure of the memory allocation is not a failure due to a lack of storage space for an area other than the heap area, the processor may perform operation 550.
상기 힙 영역의 크기 감소 또는 증가를 위한 정보를 포함하도록 상기 프로파일이 설정되면, 상기 프로세서는 동작 570에서, 상기 설정된 프로파일을 저장할 수 있다. 예를 들어, 상기 프로세서는 메모리(예: 도 2의 메모리(210))에 상기 프로파일을 저장할 수 있다. 일 실시예에 따르면, 상기 프로세서는 상기 프로파일을 상기 메모리에 파일 형태로 저장할 수 있다.When the profile is set to include information for decreasing or increasing the size of the heap area, the processor may store the set profile in operation 570. For example, the processor may store the profile in a memory (e.g., the memory (210) of FIG. 2). According to one embodiment, the processor may store the profile in the memory in the form of a file.
도 6은 본 발명의 일 실시예에 따른 가상 메모리의 할당과 관련된 처리 동작을 설명하기 위한 도면이다.FIG. 6 is a diagram for explaining processing operations related to allocation of virtual memory according to one embodiment of the present invention.
도 6을 참조하면, 전자 장치(예: 도 2의 전자 장치(200))는 어플리케이션(610)(예: 도 2의 어플리케이션(211)), 가상 머신(630), 및 힙 영역 설정 모듈(650)을 포함할 수 있다. 상기 가상 머신(630)(예: 자바 가상 머신(java virtual machine(JVM)))은 상기 전자 장치의 프로세서(예: 도 2의 프로세서(230))에 의해 실행되는 프로그램으로서, 운영 체제나 응용 프로그램(예: 어플리케이션(610))의 설치 및 실행 환경을 제공할 수 있다. 상기 가상 머신(630)은 상기 어플리케이션(610)에 대응되는 가상 메모리(예: 도 2의 가상 메모리(250))를 할당하는 가상 메모리 설정 모듈(631), 상기 가상 메모리에 대한 메모리 할당의 실패를 감지하는 메모리 할당 실패 감지 모듈(633), 상기 메모리 할당의 실패의 발생을 나타내는 신호를 처리하는 신호 처리 모듈(635), 및 상기 가상 메모리에 대한 메모리 할당의 실패를 나타내는 정보(이하, 프로파일(651)이라 한다)를 설정하는 프로파일 설정 모듈(637)을 포함할 수 있다. 상기 힙 영역 설정 모듈(650)은 상기 어플리케이션(610)에 대응되는 가상 메모리의 힙 영역(예: 도 2의 힙 영역(253))의 크기를 결정할 수 있다.Referring to FIG. 6, an electronic device (e.g., the electronic device (200) of FIG. 2) may include an application (610) (e.g., the application (211) of FIG. 2), a virtual machine (630), and a heap area setting module (650). The virtual machine (630) (e.g., a Java virtual machine (JVM)) is a program executed by a processor (e.g., the processor (230) of FIG. 2) of the electronic device, and may provide an installation and execution environment for an operating system or an application program (e.g., the application (610)). The virtual machine (630) may include a virtual memory setting module (631) that allocates virtual memory (e.g., virtual memory (250) of FIG. 2) corresponding to the application (610), a memory allocation failure detection module (633) that detects a failure in memory allocation for the virtual memory, a signal processing module (635) that processes a signal indicating the occurrence of a failure in the memory allocation, and a profile setting module (637) that sets information (hereinafter, referred to as a profile (651)) indicating a failure in memory allocation for the virtual memory. The heap area setting module (650) may determine the size of a heap area (e.g., a heap area (253) of FIG. 2) of a virtual memory corresponding to the application (610).
상기 어플리케이션(610)에 대한 실행 요청이 발생하면, 상기 가상 머신(630)은 동작 671에서, 상기 어플리케이션(610)을 실행시킬 수 있다. 상기 어플리케이션(610)의 실행 과정에서, 상기 가상 머신(630)의 가상 메모리 설정 모듈(631)은 동작 672에서, 상기 어플리케이션(610)에 대응되는 가상 메모리를 할당할 수 있다. 일 실시예에 따르면, 상기 가상 메모리 설정 모듈(631)은 상기 어플리케이션(610)의 설정 파일(611)(예: 상기 어플리케이션(610)의 패키지에 포함된 "AndroidManifest.xml" 파일)에 기반하여 상기 가상 메모리의 힙 영역의 크기를 결정할 수 있다. 예를 들어, 상기 가상 메모리 설정 모듈(631)은 상기 설정 파일(611)에 기재된 힙 영역의 크기 속성(예: "largeHeap"으로 정의되는 속성)의 설정 값(예: "true" 또는 "false"(default 값))에 따라 상기 가상 메모리의 힙 영역의 크기를 결정할 수 있다.When an execution request for the application (610) occurs, the virtual machine (630) can execute the application (610) at operation 671. During the execution process of the application (610), the virtual memory configuration module (631) of the virtual machine (630) can allocate virtual memory corresponding to the application (610) at operation 672. According to one embodiment, the virtual memory configuration module (631) can determine the size of the heap area of the virtual memory based on the configuration file (611) of the application (610) (e.g., the "AndroidManifest.xml" file included in the package of the application (610). For example, the virtual memory configuration module (631) can determine the size of the heap area of the virtual memory based on the configuration value (e.g., "true" or "false" (default value)) of the size attribute of the heap area described in the configuration file (611) (e.g., the attribute defined as "largeHeap").
상기 어플리케이션(610)의 실행 중, 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족에 따른 실패(제1 실패)가 발생하면, 상기 가상 머신(630)의 메모리 할당 실패 감지 모듈(633)은 동작 673에서, 상기 실패를 감지할 수 있다. 상기 실패를 감지한다는 것은 상기 저장 공간의 부족의 따른 메모리 할당의 실패 시 발생되는 시스템 이벤트를 감지하는 것을 의미할 수 있다. 또한, 상기 메모리 할당 실패 감지 모듈(633)은 동작 674에서, 상기 저장 공간 부족에 따른 메모리 할당의 실패 신호(제1 실패의 발생을 나타내는 신호)를 상기 가상 머신(630)의 신호 처리 모듈(635)로 전송할 수 있다. 일 실시예에 따르면, 상기 메모리 할당 실패 감지 모듈(633)은 상기 실패 신호의 전송 후, 지정된 횟수(예: 50회)의 동일한 종류의 다른 실패(제1 실패)들이 감지되면, 상기 다른 실패들의 발생을 나타내는 실패 신호들을 상기 신호 처리 모듈(635)로 전송하지 않을 수 있다. 또한, 상기 메모리 할당 실패 감지 모듈(633)은 상기 지정된 횟수의 동일한 종류의 다른 실패들을 감지한 후, 또 다른 동일한 종류의 실패(제1 실패)를 감지하면, 새롭게 감지된 실패의 발생을 나타내는 실패 신호를 상기 신호 처리 모듈(635)로 전송할 수 있다. 상기 실패 신호를 수신한 상기 신호 처리 모듈(635)은 동작 674-1에서, 상기 프로파일 설정 모듈(637)을 실행시킬 수 있다.During execution of the application (610), if a failure (first failure) occurs due to insufficient storage space for an area other than the heap area among the areas included in the virtual memory, the memory allocation failure detection module (633) of the virtual machine (630) may detect the failure at operation 673. Detecting the failure may mean detecting a system event that occurs when memory allocation fails due to insufficient storage space. In addition, the memory allocation failure detection module (633) may transmit a signal of failure of memory allocation due to insufficient storage space (a signal indicating occurrence of the first failure) to the signal processing module (635) of the virtual machine (630) at operation 674. According to one embodiment, the memory allocation failure detection module (633) may not transmit failure signals indicating occurrence of other failures to the signal processing module (635) if a specified number of (e.g., 50) other failures of the same type are detected after transmitting the failure signal. In addition, the memory allocation failure detection module (633) may transmit a failure signal indicating occurrence of a newly detected failure to the signal processing module (635) if another failure of the same type (the first failure) is detected after detecting the specified number of other failures of the same type. The signal processing module (635) that receives the failure signal may execute the profile setting module (637) in operation 674-1.
상기 프로파일 설정 모듈(637)이 실행되면, 상기 프로파일 설정 모듈(637)은 동작 675에서, 상기 어플리케이션(610)에 대응되는 상기 프로파일(651)을 설정할 수 있다. 상기 프로파일(651)이 저장되어 있지 않은 경우, 상기 프로파일 설정 모듈(637)은 상기 프로파일(651)을 새로 생성할 수 있고, 상기 프로파일(651)이 저장되어 있는 경우, 상기 프로파일 설정 모듈(637)은 상기 저장된 프로파일(651)을 수정(또는 변경)할 수 있다. 상기 프로파일 설정 모듈(637)은 상기 실패 신호의 수신에 응답하여 상기 프로파일(651)에 상기 실패 신호의 수신 개수(또는 횟수)(상기 제1 실패의 발생을 나타내는 실패 신호의 개수)를 기록할 수 있다.When the profile setting module (637) is executed, the profile setting module (637) can set the profile (651) corresponding to the application (610) in operation 675. If the profile (651) is not stored, the profile setting module (637) can newly create the profile (651), and if the profile (651) is stored, the profile setting module (637) can modify (or change) the stored profile (651). In response to receiving the failure signal, the profile setting module (637) can record the number (or number of times) of reception of the failure signal (the number of failure signals indicating the occurrence of the first failure) in the profile (651).
상기 실패 신호의 수신 개수가 지정된 값(예: 3회)을 초과하는 경우, 상기 프로파일 설정 모듈(637)은 동작 675-1에서, 상기 프로파일(651)을 설정할 수 있다. 일 예로, 상기 프로파일 설정 모듈(637)은 상기 프로파일(651)에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 감소를 나타내는 값으로 설정할 수 있다.If the number of receptions of the above failure signal exceeds a specified value (e.g., 3 times), the profile setting module (637) may set the profile (651) in operation 675-1. For example, the profile setting module (637) may set information on whether the size of the heap area included in the profile (651) has changed to a value indicating a size reduction.
상기 프로파일 설정 모듈(637)은 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패(제2 실패)가 발생하면, 동작 675-2에서, 상기 프로파일(651)에 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패의 발생 횟수를 기록할 수 있다. 또한, 상기 프로파일 설정 모듈(637)은 상기 프로파일(651)에 포함된 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 크기 증가를 나타내는 값으로 설정할 수 있다. 또한, 상기 프로파일 설정 모듈(637)은 상기 프로파일(651)에 상기 힙 영역의 실제 사용량을 기록할 수 있다.If a failure (second failure) occurs due to insufficient storage space for the heap area among the areas included in the virtual memory, the profile setting module (637) can record the number of occurrences of failure due to insufficient storage space for the heap area in the profile (651) in operation 675-2. In addition, the profile setting module (637) can set information on whether the size of the heap area included in the profile (651) has changed to a value indicating a size increase. In addition, the profile setting module (637) can record the actual usage of the heap area in the profile (651).
일 실시예에 따르면, 상기 실패 신호의 수신 개수가 상기 지정된 값을 초과하는 경우, 상기 프로파일 설정 모듈(637)은 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패의 발생 횟수를 확인할 수 있다. 상기 힙 영역에 대한 저장 공간의 부족에 따른 실패의 발생 횟수를 고려하여, 상기 프로파일 설정 모듈(637)은 상기 힙 영역의 크기에 대한 변경 여부를 결정할 수 있다. 상기 힙 영역의 크기에 대한 변경이 결정되면, 상기 프로파일 설정 모듈(637)은 상기 프로파일(651)에 상기 힙 영역의 크기에 대한 변경 여부에 관한 정보를 설정할 수 있다. 또한, 상기 프로파일 설정 모듈(637)은 상기 프로파일(651)에 상기 힙 영역의 크기 변경 값을 설정할 수 있다.According to one embodiment, if the number of receptions of the failure signal exceeds the specified value, the profile setting module (637) can check the number of occurrences of failures due to insufficient storage space for the heap area. Considering the number of occurrences of failures due to insufficient storage space for the heap area, the profile setting module (637) can determine whether to change the size of the heap area. If a change in the size of the heap area is determined, the profile setting module (637) can set information on whether to change the size of the heap area in the profile (651). In addition, the profile setting module (637) can set a size change value of the heap area in the profile (651).
상기 어플리케이션(610)에 대한 재실행 요청이 발생하면, 상기 가상 머신(630)은 동작 676에서, 상기 어플리케이션(610)을 재실행시킬 수 있다. 상기 어플리케이션(610)의 재실행 과정에서, 상기 가상 메모리 설정 모듈(631)은 상기 어플리케이션(610)에 대응되는 가상 메모리를 할당하게 되는데, 이때 상기 프로파일(651)이 존재하는 경우(상기 프로파일(651)이 저장된 경우), 상기 힙 영역 설정 모듈(650)은 동작 677에서, 상기 프로파일(651)에 기반하여 상기 가상 메모리의 힙 영역의 크기를 결정할 수 있다. 예를 들어, 상기 힙 영역 설정 모듈(650)은 상기 프로파일(651)에 기록된 상기 힙 영역의 크기 변경 값에 기반하여 상기 힙 영역의 크기를 설정(또는 변경)할 수 있다. 예를 들어, 상기 어플리케이션(610)의 설정 파일(611)에 기재된 힙 영역의 크기 속성의 설정 값은 무시될 수 있다. 일 실시예에 따르면, 상기 프로파일(651)에 기반하여 상기 가상 메모리의 힙 영역의 크기가 결정되고 나면, 상기 힙 영역 설정 모듈(650)은 상기 프로파일(651)에 기록된 정보를 리셋할 수 있다. 어떤 실시예에서, 상기 힙 영역 설정 모듈(650)은 상기 프로파일(651)에 기록된 상기 힙 영역의 크기 변경 값을 제외한 나머지 정보를 리셋할 수 있다.When a request for re-execution of the application (610) occurs, the virtual machine (630) can re-execute the application (610) at operation 676. During the re-execution process of the application (610), the virtual memory setting module (631) allocates virtual memory corresponding to the application (610). At this time, if the profile (651) exists (if the profile (651) is stored), the heap area setting module (650) can determine the size of the heap area of the virtual memory based on the profile (651) at operation 677. For example, the heap area setting module (650) can set (or change) the size of the heap area based on the size change value of the heap area recorded in the profile (651). For example, the setting value of the size attribute of the heap area described in the setting file (611) of the application (610) can be ignored. According to one embodiment, after the size of the heap area of the virtual memory is determined based on the profile (651), the heap area setting module (650) can reset the information recorded in the profile (651). In some embodiments, the heap area setting module (650) can reset the remaining information except for the size change value of the heap area recorded in the profile (651).
다양한 실시예에 따르면, 본 문서에 개시된 다양한 실시예들은 자바 가상 머신(java virtual machine) 뿐만 아니라, CLR(common language runtime)과 같은 Windows 운영체제에서 구현되는 가상 머신에도 적용될 수 있다.According to various embodiments, the various embodiments disclosed in this document can be applied not only to the Java virtual machine, but also to a virtual machine implemented in the Windows operating system, such as the common language runtime (CLR).
상술한 바와 같이, 다양한 실시예에 따르면, 전자 장치(예: 도 2의 전자 장치(200))의 가상 메모리의 할당 방법은, 상기 전자 장치의 메모리(예: 도 2의 메모리(210))에 저장된 어플리케이션(예: 도 2의 어플리케이션(211))의 실행 중 상기 어플리케이션에 대응되는 가상 메모리(예: 도 2의 가상 메모리(250))에 대한 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하는 동작(예: 도 3의 동작 330), 상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 힙 영역(예: 도 2의 힙 영역(253))의 크기를 결정하는 동작(예: 도 4의 동작 450), 및 상기 결정된 크기의 힙 영역을 포함하는 상기 가상 메모리를 할당하는 동작(예: 도 4의 동작 470)을 포함할 수 있다.As described above, according to various embodiments, a method for allocating virtual memory of an electronic device (e.g., the electronic device (200) of FIG. 2) may include, when memory allocation for a virtual memory (e.g., the virtual memory (250) of FIG. 2) corresponding to an application (e.g., the application (211) of FIG. 2) stored in a memory (e.g., the memory (210) of FIG. 2) of the electronic device fails during execution of the application, an operation for setting information indicating a failure of the memory allocation (e.g., operation 330 of FIG. 3), when the application is re-executed, an operation for determining a size of a heap area (e.g., the heap area (253) of FIG. 2) included in the virtual memory based on the set information if the set information exists (e.g., operation 450 of FIG. 4), and an operation for allocating the virtual memory including the heap area of the determined size (e.g., operation 470 of FIG. 4).
다양한 실시예에 따르면, 상기 힙 영역의 크기를 결정하는 동작은, 상기 설정된 정보가 존재하면, 상기 어플리케이션의 설정 파일에 기재된 상기 힙 영역의 크기 속성의 설정 값을 무시하는 동작을 포함할 수 있다.According to various embodiments, the operation of determining the size of the heap area may include an operation of ignoring the set value of the size attribute of the heap area described in the configuration file of the application, if the set information exists.
다양한 실시예에 따르면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하는 동작은, 상기 어플리케이션의 실행에 따른 상기 힙 영역의 실제 사용량을 상기 설정된 정보에 포함시키는 동작을 포함하고, 상기 힙 영역의 크기를 결정하는 동작은, 상기 힙 영역의 실제 사용량에 기반하여 상기 힙 영역의 크기를 결정하는 동작을 포함할 수 있다.According to various embodiments, the operation of setting information indicating a failure of the memory allocation may include an operation of including an actual usage of the heap area according to execution of the application in the set information, and the operation of determining the size of the heap area may include an operation of determining the size of the heap area based on the actual usage of the heap area.
다양한 실시예에 따르면, 상기 힙 영역의 크기는 지정된 개수로 구분된 크기 범위들을 나타내는 단계 값으로 설정되고, 상기 힙 영역의 크기를 결정하는 동작은, 상기 크기 범위들 중 상기 힙 영역의 실제 사용량이 포함되는 크기 범위를 나타내는 단계 값으로 상기 힙 영역의 크기를 설정하는 동작을 포함할 수 있다.According to various embodiments, the size of the heap area is set to a step value representing a size range divided by a specified number, and the operation of determining the size of the heap area may include an operation of setting the size of the heap area to a step value representing a size range within which an actual usage amount of the heap area is included among the size ranges.
다양한 실시예에 따르면, 상기 메모리 할당의 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족 시 발생되는 제1 실패를 포함할 수 있다.According to various embodiments, the failure of the memory allocation may include a first failure that occurs when there is insufficient storage space for an area other than the heap area among the areas included in the virtual memory.
다양한 실시예에 따르면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하는 동작은, 상기 제1 실패의 발생 시, 상기 설정된 정보에 상기 힙 영역의 크기를 줄이기 위한 정보를 포함시키는 동작(예: 도 5의 동작 530)을 포함할 수 있다.According to various embodiments, the operation of setting information indicating a failure of the memory allocation may include an operation of including information for reducing the size of the heap area in the set information when the first failure occurs (e.g., operation 530 of FIG. 5).
다양한 실시예에 따르면, 상기 가상 메모리의 할당 방법은, 상기 제1 실패의 발생 시, 상기 어플리케이션의 실행과 관련된 프로세스로 상기 제1 실패의 발생을 나타내는 신호를 전송하는 동작을 더 포함할 수 있다.According to various embodiments, the method for allocating virtual memory may further include, when the first failure occurs, transmitting a signal indicating the occurrence of the first failure to a process associated with execution of the application.
다양한 실시예에 따르면, 상기 가상 메모리의 할당 방법은, 상기 신호의 전송 후, 지정된 횟수의 다른 제1 실패들이 발생되면, 상기 다른 제1 실패들의 발생을 나타내는 신호들을 상기 프로세스로 전송하지 않도록 제어하는 동작, 상기 다른 제1 실패들의 발생 후, 또 다른 제1 실패가 발생되면, 상기 또 다른 제1 실패의 발생을 나타내는 신호를 상기 프로세스로 전송하는 동작, 및 상기 프로세스가 수신한 상기 신호의 개수가 지정된 값을 초과하면, 상기 힙 영역의 크기에 대한 변경 여부를 결정하는 동작을 더 포함할 수 있다.According to various embodiments, the method for allocating virtual memory may further include: an operation for controlling, if a specified number of other first failures occur after transmitting the signal, not to transmit signals indicating occurrence of the other first failures to the process; an operation for transmitting, if another first failure occurs after the occurrence of the other first failures, a signal indicating occurrence of the other first failure to the process; and an operation for determining, if the number of the signals received by the process exceeds a specified value, whether to change the size of the heap area.
다양한 실시예에 따르면, 상기 메모리 할당의 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족 시 발생되는 제2 실패를 포함할 수 있다.According to various embodiments, the failure of said memory allocation may include a second failure that occurs when there is insufficient storage space for said heap area among the areas included in said virtual memory.
다양한 실시예에 따르면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하는 동작은, 상기 제2 실패의 발생 시, 상기 설정된 정보에 상기 힙 영역의 크기를 늘리기 위한 정보를 포함시키는 동작(예: 도 5의 동작 550)을 포함할 수 있다.According to various embodiments, the operation of setting information indicating a failure of the memory allocation may include an operation of including information for increasing the size of the heap area in the set information when the second failure occurs (e.g., operation 550 of FIG. 5).
본 문서에 개시된 다양한 실시예들에 따른 전자 장치는 다양한 형태의 장치가 될 수 있다. 전자 장치는, 예를 들면, 휴대용 통신 장치(예: 스마트폰), 컴퓨터 장치, 휴대용 멀티미디어 장치, 휴대용 의료 기기, 카메라, 웨어러블 장치, 또는 가전 장치를 포함할 수 있다. 본 문서의 실시예에 따른 전자 장치는 전술한 기기들에 한정되지 않는다.The electronic devices according to various embodiments disclosed in this document may be devices of various forms. The electronic devices may include, for example, portable communication devices (e.g., smartphones), computer devices, portable multimedia devices, portable medical devices, cameras, wearable devices, or home appliance devices. The electronic devices according to embodiments of this document are not limited to the above-described devices.
본 문서의 다양한 실시예들 및 이에 사용된 용어들은 본 문서에 기재된 기술적 특징들을 특정한 실시예들로 한정하려는 것이 아니며, 해당 실시예의 다양한 변경, 균등물, 또는 대체물을 포함하는 것으로 이해되어야 한다. 도면의 설명과 관련하여, 유사한 또는 관련된 구성요소에 대해서는 유사한 참조 부호가 사용될 수 있다. 아이템에 대응하는 명사의 단수 형은 관련된 문맥상 명백하게 다르게 지시하지 않는 한, 상기 아이템 한 개 또는 복수 개를 포함할 수 있다. 본 문서에서, "A 또는 B", "A 및 B 중 적어도 하나", "A 또는 B 중 적어도 하나", "A, B 또는 C", "A, B 및 C 중 적어도 하나", 및 "A, B, 또는 C 중 적어도 하나"와 같은 문구들 각각은 그 문구들 중 해당하는 문구에 함께 나열된 항목들 중 어느 하나, 또는 그들의 모든 가능한 조합을 포함할 수 있다. "제1", "제2", 또는 "첫째" 또는 "둘째"와 같은 용어들은 단순히 해당 구성요소를 다른 해당 구성요소와 구분하기 위해 사용될 수 있으며, 해당 구성요소들을 다른 측면(예: 중요성 또는 순서)에서 한정하지 않는다. 어떤(예: 제1) 구성요소가 다른(예: 제2) 구성요소에, "기능적으로" 또는 "통신적으로"라는 용어와 함께 또는 이런 용어 없이, "커플드" 또는 "커넥티드"라고 언급된 경우, 그것은 상기 어떤 구성요소가 상기 다른 구성요소에 직접적으로(예: 유선으로), 무선으로, 또는 제 3 구성요소를 통하여 연결될 수 있다는 것을 의미한다.It should be understood that the various embodiments of this document and the terminology used herein are not intended to limit the technical features described in this document to specific embodiments, but include various modifications, equivalents, or substitutes of the embodiments. In connection with the description of the drawings, similar reference numerals may be used for similar or related components. The singular form of a noun corresponding to an item may include one or more of the items, unless the context clearly dictates otherwise. In this document, each of the phrases "A or B", "at least one of A and B", "at least one of A or B", "A, B, or C", "at least one of A, B, and C", and "at least one of A, B, or C" can include any one of the items listed together in the corresponding phrase, or all possible combinations thereof. Terms such as "first", "second", or "first" or "second" may be used merely to distinguish one component from another, and do not limit the components in any other respect (e.g., importance or order). When a component (e.g., a first component) is referred to as "coupled" or "connected" to another (e.g., a second component), with or without the terms "functionally" or "communicatively," it means that the component can be connected to the other component directly (e.g., wired), wirelessly, or through a third component.
본 문서의 다양한 실시예들에서 사용된 용어 "모듈"은 하드웨어, 소프트웨어 또는 펌웨어로 구현된 유닛을 포함할 수 있으며, 예를 들면, 로직, 논리 블록, 부품, 또는 회로와 같은 용어와 상호 호환적으로 사용될 수 있다. 모듈은, 일체로 구성된 부품 또는 하나 또는 그 이상의 기능을 수행하는, 상기 부품의 최소 단위 또는 그 일부가 될 수 있다. 예를 들면, 일 실시예에 따르면, 모듈은 ASIC(application-specific integrated circuit)의 형태로 구현될 수 있다.The term "module" used in various embodiments of this document may include a unit implemented in hardware, software or firmware, and may be used interchangeably with terms such as logic, logic block, component, or circuit, for example. A module may be an integrally configured component or a minimum unit of the component or a portion thereof that performs one or more functions. For example, according to one embodiment, a module may be implemented in the form of an application-specific integrated circuit (ASIC).
본 문서의 다양한 실시예들은 기기(machine)(예: 전자 장치(101))에 의해 읽을 수 있는 저장 매체(storage medium)(예: 내장 메모리(136) 또는 외장 메모리(138))에 저장된 하나 이상의 명령어들을 포함하는 소프트웨어(예: 프로그램(140))로서 구현될 수 있다. 예를 들면, 기기(예: 전자 장치(101))의 프로세서(예: 프로세서(120))는, 저장 매체로부터 저장된 하나 이상의 명령어들 중 적어도 하나의 명령을 호출하고, 그것을 실행할 수 있다. 이것은 기기가 상기 호출된 적어도 하나의 명령어에 따라 적어도 하나의 기능을 수행하도록 운영되는 것을 가능하게 한다. 상기 하나 이상의 명령어들은 컴파일러에 의해 생성된 코드 또는 인터프리터에 의해 실행될 수 있는 코드를 포함할 수 있다. 기기로 읽을 수 있는 저장 매체는, 비일시적(non-transitory) 저장 매체의 형태로 제공될 수 있다. 여기서, '비일시적'은 저장 매체가 실재(tangible)하는 장치이고, 신호(signal)(예: 전자기파)를 포함하지 않는다는 것을 의미할 뿐이며, 이 용어는 데이터가 저장 매체에 반영구적으로 저장되는 경우와 임시적으로 저장되는 경우를 구분하지 않는다.Various embodiments of the present document may be implemented as software (e.g., a program (140)) including one or more instructions stored in a storage medium (e.g., an internal memory (136) or an external memory (138)) readable by a machine (e.g., an electronic device (101)). For example, a processor (e.g., a processor (120)) of the machine (e.g., an electronic device (101)) may call at least one instruction among the one or more instructions stored from the storage medium and execute it. This enables the machine to operate to perform at least one function according to the at least one called instruction. The one or more instructions may include code generated by a compiler or code executable by an interpreter. The machine-readable storage medium may be provided in the form of a non-transitory storage medium. Here, 'non-transitory' simply means that the storage medium is a tangible device and does not contain signals (e.g. electromagnetic waves), and the term does not distinguish between cases where data is stored semi-permanently or temporarily on the storage medium.
일 실시예에 따르면, 본 문서에 개시된 다양한 실시예들에 따른 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다. 컴퓨터 프로그램 제품은 상품으로서 판매자 및 구매자 간에 거래될 수 있다. 컴퓨터 프로그램 제품은 기기로 읽을 수 있는 저장 매체(예: compact disc read only memory(CD-ROM))의 형태로 배포되거나, 또는 어플리케이션 스토어(예: 플레이 스토어TM)를 통해 또는 두 개의 사용자 장치들(예: 스마트 폰들) 간에 직접, 온라인으로 배포(예: 다운로드 또는 업로드)될 수 있다. 온라인 배포의 경우에, 컴퓨터 프로그램 제품의 적어도 일부는 제조사의 서버, 어플리케이션 스토어의 서버, 또는 중계 서버의 메모리와 같은 기기로 읽을 수 있는 저장 매체에 적어도 일시 저장되거나, 임시적으로 생성될 수 있다.According to one embodiment, the method according to various embodiments disclosed in the present document may be provided as included in a computer program product. The computer program product may be traded between a seller and a buyer as a commodity. The computer program product may be distributed in the form of a machine-readable storage medium (e.g., a compact disc read only memory (CD-ROM)), or may be distributed online (e.g., downloaded or uploaded) via an application store (e.g., Play Store TM ) or directly between two user devices (e.g., smart phones). In the case of online distribution, at least a part of the computer program product may be at least temporarily stored or temporarily generated in a machine-readable storage medium, such as a memory of a manufacturer's server, a server of an application store, or an intermediary server.
다양한 실시예들에 따르면, 상기 기술한 구성요소들의 각각의 구성요소(예: 모듈 또는 프로그램)는 단수 또는 복수의 개체를 포함할 수 있으며, 복수의 개체 중 일부는 다른 구성요소에 분리 배치될 수도 있다. 다양한 실시예들에 따르면, 전술한 해당 구성요소들 중 하나 이상의 구성요소들 또는 동작들이 생략되거나, 또는 하나 이상의 다른 구성요소들 또는 동작들이 추가될 수 있다. 대체적으로 또는 추가적으로, 복수의 구성요소들(예: 모듈 또는 프로그램)은 하나의 구성요소로 통합될 수 있다. 이런 경우, 통합된 구성요소는 상기 복수의 구성요소들 각각의 구성요소의 하나 이상의 기능들을 상기 통합 이전에 상기 복수의 구성요소들 중 해당 구성요소에 의해 수행되는 것과 동일 또는 유사하게 수행할 수 있다. 다양한 실시예들에 따르면, 모듈, 프로그램 또는 다른 구성요소에 의해 수행되는 동작들은 순차적으로, 병렬적으로, 반복적으로, 또는 휴리스틱하게 실행되거나, 상기 동작들 중 하나 이상이 다른 순서로 실행되거나, 생략되거나, 또는 하나 이상의 다른 동작들이 추가될 수 있다.According to various embodiments, each component (e.g., a module or a program) of the above-described components may include a single or multiple entities, and some of the multiple entities may be separately arranged in other components. According to various embodiments, one or more components or operations of the above-described corresponding components may be omitted, or one or more other components or operations may be added. Alternatively or additionally, the multiple components (e.g., a module or a program) may be integrated into one component. In such a case, the integrated component may perform one or more functions of each of the multiple components identically or similarly to those performed by the corresponding component of the multiple components before the integration. According to various embodiments, the operations performed by the module, program, or other component may be executed sequentially, in parallel, repeatedly, or heuristically, or one or more of the operations may be executed in a different order, omitted, or one or more other operations may be added.
Claims (20)
명령어들 및 어플리케이션을 저장하는 메모리; 및
처리 회로(processing circuitry)를 포함하는 적어도 하나의 프로세서를 포함하고,
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가:
상기 어플리케이션의 실행 중 상기 어플리케이션에 대응되는 가상 메모리에 포함된 복수개의 영역들 중 적어도 하나의 영역에 대한 저장 공간의 부족으로 인하여 상기 어플리케이션에 대한 상기 가상 메모리의 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하고, 상기 설정된 정보는, 상기 가상 메모리에 포함된 복수개의 영역들 중 힙(heap) 영역이 차지할 영역의 크기를 설정하기 위한 정보를 포함하고,
상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 상기 복수개의 영역들 중 상기 힙 영역이 차지할 영역의 크기 값을 결정하고,
상기 결정된 크기 값이 상기 메모리 할당이 실패했을 때에 상기 가상 메모리 내의 상기 힙 영역의 크기 값과 상이한 경우, 상기 가상 메모리에서 상기 힙 영역이 차지하는 영역의 크기를 상기 결정된 크기 값으로 변경하고,
상기 재실행된 어플리케이션에 대하여 상기 결정된 크기 값으로 변경된 상기 힙 영역을 포함하는 상기 가상 메모리를 할당하도록 설정된 전자 장치.
In electronic devices,
Memory for storing commands and applications; and
comprising at least one processor comprising processing circuitry;
The above instructions are collectively or individually executed by the at least one processor, such that the electronic device:
If memory allocation of the virtual memory for the application fails due to insufficient storage space for at least one area among a plurality of areas included in the virtual memory corresponding to the application during execution of the application, information indicating the failure of the memory allocation is set, and the set information includes information for setting the size of an area to be occupied by a heap area among a plurality of areas included in the virtual memory,
When the above application is re-executed, if the above set information exists, the size value of the area to be occupied by the heap area among the multiple areas included in the virtual memory is determined based on the above set information,
If the determined size value is different from the size value of the heap area in the virtual memory when the memory allocation fails, the size of the area occupied by the heap area in the virtual memory is changed to the determined size value,
An electronic device set to allocate the virtual memory including the heap area changed to the determined size value for the re-executed application.
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 어플리케이션의 설정 파일에 기재된 상기 힙 영역의 크기 속성의 설정 값을 무시하도록 설정된 전자 장치.
In claim 1,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
An electronic device configured to ignore the setting value of the size attribute of the heap area described in the configuration file of the application when the above-described application is re-executed, if the above-described set information exists.
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 어플리케이션의 실행에 따른 상기 힙 영역의 실제 사용량을 상기 설정된 정보에 포함시키고,
상기 힙 영역의 실제 사용량에 기반하여 상기 힙 영역의 크기를 결정하도록 설정된 전자 장치.
In claim 1,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
The actual usage of the heap area according to the execution of the above application is included in the above set information,
An electronic device configured to determine the size of said heap area based on actual usage of said heap area.
상기 힙 영역의 크기는 지정된 개수로 구분된 크기 범위들을 나타내는 단계 값으로 설정되고,
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 크기 범위들 중 상기 힙 영역의 실제 사용량이 포함되는 크기 범위를 나타내는 단계 값으로 상기 힙 영역의 크기를 설정하는 전자 장치.
In claim 3,
The size of the above heap area is set to a step value representing a size range divided by a specified number,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
An electronic device that sets the size of the heap area to a step value representing a size range within which the actual usage of the heap area is included among the above size ranges.
상기 메모리 할당의 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역 이외의 영역에 대한 저장 공간의 부족 시 발생되는 제1 실패를 포함하는 전자 장치.In claim 1,
An electronic device in which the above memory allocation failure includes a first failure that occurs when there is insufficient storage space for an area other than the heap area among the areas included in the virtual memory.
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 제1 실패의 발생 시, 상기 설정된 정보에 상기 힙 영역의 크기를 줄이기 위한 정보를 포함시키도록 설정된 전자 장치.
In claim 5,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
An electronic device configured to include information for reducing the size of the heap area in the set information when the first failure occurs.
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 제1 실패의 발생 시, 상기 어플리케이션의 실행과 관련된 프로세스로 상기 제1 실패의 발생을 나타내는 신호를 전송하도록 설정된 전자 장치.
In claim 5,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
An electronic device configured to transmit a signal indicating the occurrence of the first failure to a process associated with the execution of the application when the first failure occurs.
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 신호의 전송 후, 지정된 횟수의 다른 제1 실패들이 발생되면, 상기 다른 제1 실패들의 발생을 나타내는 신호들을 상기 프로세스로 전송하지 않도록 제어하고,
상기 다른 제1 실패들의 발생 후, 또 다른 제1 실패가 발생되면, 상기 또 다른 제1 실패의 발생을 나타내는 신호를 상기 프로세스로 전송하고,
상기 프로세스가 수신한 상기 신호의 개수가 지정된 값을 초과하면, 상기 힙 영역의 크기에 대한 변경 여부를 결정하도록 설정된 전자 장치.
In claim 7,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
After the transmission of the above signal, if a specified number of other first failures occur, control is provided so that signals indicating the occurrence of the other first failures are not transmitted to the process.
After the occurrence of the above other first failures, if another first failure occurs, a signal indicating the occurrence of the above other first failure is transmitted to the process,
An electronic device configured to determine whether to change the size of the heap area if the number of said signals received by said process exceeds a specified value.
상기 메모리 할당의 실패는 상기 가상 메모리에 포함된 영역들 중 상기 힙 영역에 대한 저장 공간의 부족 시 발생되는 제2 실패를 포함하고,
상기 명령어들은, 상기 적어도 하나의 프로세서에 의해 집합적으로(collectively) 또는 개별적으로(individually) 실행되어, 상기 전자 장치가,
상기 제2 실패의 발생 시, 상기 설정된 정보에 상기 힙 영역의 크기를 늘리기 위한 정보를 포함시키도록 설정된 전자 장치.
In claim 1,
The failure of the above memory allocation includes a second failure that occurs when there is insufficient storage space for the heap area among the areas included in the virtual memory,
The above instructions are collectively or individually executed by the at least one processor, so that the electronic device,
An electronic device configured to include information for increasing the size of the heap area in the set information when the second failure occurs.
상기 전자 장치의 메모리에 저장된 어플리케이션의 실행 중 상기 어플리케이션에 대응되는 가상 메모리에 포함된 복수개의 영역들 중 적어도 하나의 영역에 대한 저장 공간의 부족으로 인하여 상기 어플리케이션에 대한 상기 가상 메모리의 메모리 할당이 실패하면, 상기 메모리 할당의 실패를 나타내는 정보를 설정하는 동작, 상기 설정된 정보는, 상기 가상 메모리에 포함된 복수개의 영역들 중 힙(heap) 영역이 차지할 영역의 크기를 설정하기 위한 정보를 포함함;
상기 어플리케이션의 재실행 시, 상기 설정된 정보가 존재하면, 상기 설정된 정보에 기반하여 상기 가상 메모리에 포함된 상기 복수개의 영역들 중 상기 힙 영역이 차지할 영역의 크기 값을 결정하는 동작;
상기 결정된 크기 값이 상기 메모리 할당이 실패했을 때에 상기 가상 메모리 내의 상기 힙 영역의 크기 값과 상이한 경우, 상기 가상 메모리에서 상기 힙 영역이 차지하는 영역의 크기를 상기 결정된 크기 값으로 변경하는 동작; 및
상기 재실행된 어플리케이션에 대하여 상기 결정된 크기 값으로 변경된 상기 힙 영역을 포함하는 상기 가상 메모리를 할당하는 동작을 포함하는 가상 메모리의 할당 방법.In a method of allocating virtual memory of an electronic device,
An operation of setting information indicating a failure of the memory allocation when memory allocation of the virtual memory for the application fails due to insufficient storage space for at least one area among a plurality of areas included in a virtual memory corresponding to the application while the application stored in the memory of the electronic device is being executed, the set information including information for setting a size of an area to be occupied by a heap area among a plurality of areas included in the virtual memory;
When the application is re-executed, if the set information exists, an operation of determining the size value of an area to be occupied by the heap area among the multiple areas included in the virtual memory based on the set information;
If the determined size value is different from the size value of the heap area in the virtual memory when the memory allocation fails, an operation of changing the size of the area occupied by the heap area in the virtual memory to the determined size value; and
A method for allocating virtual memory, comprising an operation of allocating the virtual memory including the heap area changed to the determined size value for the re-executed application.
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020200097640A KR102838101B1 (en) | 2020-08-04 | 2020-08-04 | Method for allocating of virtual memory and electronic device supporting the same |
| PCT/KR2021/010169 WO2022030964A1 (en) | 2020-08-04 | 2021-08-03 | Method for allocating virtual memory and electronic device supporting same |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020200097640A KR102838101B1 (en) | 2020-08-04 | 2020-08-04 | Method for allocating of virtual memory and electronic device supporting the same |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| KR20220017309A KR20220017309A (en) | 2022-02-11 |
| KR102838101B1 true KR102838101B1 (en) | 2025-07-25 |
Family
ID=80118644
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| KR1020200097640A Active KR102838101B1 (en) | 2020-08-04 | 2020-08-04 | Method for allocating of virtual memory and electronic device supporting the same |
Country Status (2)
| Country | Link |
|---|---|
| KR (1) | KR102838101B1 (en) |
| WO (1) | WO2022030964A1 (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009199549A (en) * | 2008-02-25 | 2009-09-03 | Nec Corp | Computer system, method and program for allocating resources to virtual machines |
| KR101932523B1 (en) * | 2018-07-16 | 2018-12-26 | 서강대학교 산학협력단 | Method for dynamically increasing and decreasing the slots of virtual gpu memory allocated to a virtual machine and computing device implementing the same |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20060033606A (en) * | 2004-10-15 | 2006-04-19 | 주식회사 팬택앤큐리텔 | Heap memory manager and its method |
| KR20080012664A (en) * | 2006-08-04 | 2008-02-12 | 한국과학기술원 | Computer and method for managing heap area of multiple applications without virtual memory |
| US9880761B2 (en) * | 2015-12-28 | 2018-01-30 | International Business Machines Corporation | Restorable memory allocator |
| KR102498668B1 (en) * | 2017-05-17 | 2023-02-09 | 삼성전자주식회사 | Method and host device for flash-aware heap memory management |
-
2020
- 2020-08-04 KR KR1020200097640A patent/KR102838101B1/en active Active
-
2021
- 2021-08-03 WO PCT/KR2021/010169 patent/WO2022030964A1/en not_active Ceased
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009199549A (en) * | 2008-02-25 | 2009-09-03 | Nec Corp | Computer system, method and program for allocating resources to virtual machines |
| KR101932523B1 (en) * | 2018-07-16 | 2018-12-26 | 서강대학교 산학협력단 | Method for dynamically increasing and decreasing the slots of virtual gpu memory allocated to a virtual machine and computing device implementing the same |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2022030964A1 (en) | 2022-02-10 |
| KR20220017309A (en) | 2022-02-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20230214262A1 (en) | Electronic device for managing memory, operation method of electronic device, and non-transitory storage medium | |
| US12455702B2 (en) | Electronic device for selectively compressing and decompressing files based on free space and use frequency | |
| US12086420B2 (en) | Memory management method and electronic device | |
| KR102880906B1 (en) | Electronic device and memory management method of the electronic device | |
| KR20240025417A (en) | Method for managing memory and electronic device supporting the same | |
| KR20220102056A (en) | Electronic device for managing memory and method of operating the same | |
| KR102838101B1 (en) | Method for allocating of virtual memory and electronic device supporting the same | |
| US12287983B2 (en) | Data swapping method and electronic device supporting same | |
| EP4357902A1 (en) | Electronic device for managing storage space, and method for operating electronic device | |
| US20240211137A1 (en) | Electronic device for managing memory and operating method thereof | |
| EP4261681A1 (en) | Electronic device and method for loading kernel module of electronic device | |
| EP4617883A1 (en) | Electronic device and memory management method | |
| US11907166B2 (en) | Electronic device and method for updating database based on reserved space | |
| US20230237025A1 (en) | Electronic device for managing journal file and operation method thereof | |
| US12223185B2 (en) | Electronic device and method for managing memory of electronic device | |
| US12271295B2 (en) | Electronic device performing method of controlling memory based on temperature and available area of the memory | |
| US20230342209A1 (en) | Service operation method and electronic device supporting same | |
| KR20240133101A (en) | Method for dynamically changing size of execution screen and electronic device thereof | |
| KR20260010199A (en) | Method for executing process, electronic device for supporting the same, and storage medium | |
| KR20250122789A (en) | Electronic device and method for managing memory | |
| KR20250176084A (en) | Electronic device for controlling performance of processor based on current discharging from battery and method performed by the same | |
| KR20240138426A (en) | Electronic device performing back off and method for operating thereof | |
| KR20240162409A (en) | Electronic device and method for controlling brightness of display | |
| KR20220102489A (en) | Electronic device and method for updating database based on reserve space | |
| KR20260019342A (en) | Electronic device and method for restoring of csme using bios in the electronic device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PA0109 | Patent application |
St.27 status event code: A-0-1-A10-A12-nap-PA0109 |
|
| PG1501 | Laying open of application |
St.27 status event code: A-1-1-Q10-Q12-nap-PG1501 |
|
| E13-X000 | Pre-grant limitation requested |
St.27 status event code: A-2-3-E10-E13-lim-X000 |
|
| P11-X000 | Amendment of application requested |
St.27 status event code: A-2-2-P10-P11-nap-X000 |
|
| P13-X000 | Application amended |
St.27 status event code: A-2-2-P10-P13-nap-X000 |
|
| PA0201 | Request for examination |
St.27 status event code: A-1-2-D10-D11-exm-PA0201 |
|
| PE0902 | Notice of grounds for rejection |
St.27 status event code: A-1-2-D10-D21-exm-PE0902 |
|
| P11-X000 | Amendment of application requested |
St.27 status event code: A-2-2-P10-P11-nap-X000 |
|
| P13-X000 | Application amended |
St.27 status event code: A-2-2-P10-P13-nap-X000 |
|
| E701 | Decision to grant or registration of patent right | ||
| PE0701 | Decision of registration |
St.27 status event code: A-1-2-D10-D22-exm-PE0701 |
|
| F11 | Ip right granted following substantive examination |
Free format text: ST27 STATUS EVENT CODE: A-2-4-F10-F11-EXM-PR0701 (AS PROVIDED BY THE NATIONAL OFFICE) |
|
| PR0701 | Registration of establishment |
St.27 status event code: A-2-4-F10-F11-exm-PR0701 |
|
| PR1002 | Payment of registration fee |
St.27 status event code: A-2-2-U10-U11-oth-PR1002 Fee payment year number: 1 |
|
| U11 | Full renewal or maintenance fee paid |
Free format text: ST27 STATUS EVENT CODE: A-2-2-U10-U11-OTH-PR1002 (AS PROVIDED BY THE NATIONAL OFFICE) Year of fee payment: 1 |
|
| PG1601 | Publication of registration |
St.27 status event code: A-4-4-Q10-Q13-nap-PG1601 |
|
| Q13 | Ip right document published |
Free format text: ST27 STATUS EVENT CODE: A-4-4-Q10-Q13-NAP-PG1601 (AS PROVIDED BY THE NATIONAL OFFICE) |