Electronic device and method of operating the same
By monitoring the reference table in the Java running environment and terminating the application that provides exception objects, the reference table overflow problem is solved and the system stability is improved.
Patent Information
- Application Number
- CN201980050237.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-07-27
- Filing Date
- 2019-04-25
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2039-04-25
AI Technical Summary
In the Java running environment, the overflow problem of reference tables leads to system recovery problems, which are difficult to effectively solve in the existing technology.
Prevent reference table overflow by monitoring the reference table in an electronic device, identifying and terminating the application that provides exception objects.
Effectively prevent reference table overflow, avoid system recovery problems, and improve system stability.
Smart Images

Figure CN112534409B_ABST
Abstract
Description
Technical Field
[0001] Various embodiments of the present disclosure relate to a method for managing memory in a Java runtime environment and an electronic device for executing the method. Background Art
[0002] With the development of information and communication technology and semiconductor technology, various electronic devices are developing into multimedia devices that provide various multimedia services. For example, the multimedia service may include at least one of a voice call service, a message service, a broadcast service, a wireless Internet service, a camera service, a video playback service, and a music playback service.
[0003] To this end, the electronic device has various applications corresponding to the multimedia service function. The application can be run by a virtual machine (e.g., a Java virtual machine, a Dalvik virtual machine, etc.) driven on the operating system of the electronic device. The virtual machine can provide a garbage collection function that releases blocks that are no longer used in the allocated heap memory blocks. Summary of the invention
[0004] Technical issues
[0005] Typically, garbage collection is performed based on reference information about objects stored in the heap (e.g., the root set of a thread). For example, reachable objects referenced in the root set of a thread are excluded from garbage collection targets, and unreachable objects not referenced in the root set can be designated as garbage collection targets.
[0006] The reference information may be stored in the form of a table and thus represented as a reference table. When the reference information is continuously accumulated, overflow of the reference table occurs, and this may cause problems in system (eg, system server) recovery.
[0007] Various embodiments of the present disclosure may provide an apparatus and method for preventing a reference table from overflowing in an electronic device.
[0008] Various embodiments of the present disclosure may provide an apparatus and method for monitoring a reference table to identify an application providing an abnormal object in an electronic device.
[0009] Various embodiments of the present disclosure may provide an apparatus and method for terminating an operation of an application providing an abnormal object in an electronic device.
[0010] Solution to the problem
[0011] The electronic device of various embodiments of the present disclosure may include a processor and a memory electrically connected to the processor. The memory may be configured to store a plurality of Java applications, and may store instructions that, when executed, cause the processor to run a virtual machine configured to run at least one Java application stored in the memory. In response to the provision of an object detected during the execution of the Java application, the virtual machine executed by the processor may provide a reference to the provided object, and identify an application that has provided a threshold or more of the object based on the provided reference, and provide information related to the identified application to the processor.
[0012] The operating method of the electronic device of various embodiments of the present disclosure may include: running a Java application through a virtual machine, and in response to detecting the provision of an object during the running of the Java application, providing a reference to the provided object, and identifying an application that has provided a threshold or more of the object based on the provided reference, and providing information related to the identified application.
[0013] Beneficial effects of the present invention
[0014] According to various embodiments, the operation of the electronic device and the apparatus may prevent the occurrence of overflow of the reference table by monitoring the reference table and initiating the end of the operation of the application providing the abnormal object or the deletion of the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a block diagram of an electronic device within a network environment according to various embodiments.
[0016] Figure 2 is a block diagram illustrating a procedure according to various embodiments.
[0017] FIG. 3A is a block diagram illustrating a runtime library according to various embodiments.
[0018] FIG. 3B is a diagram for explaining reference information according to various embodiments.
[0019] Figure 4 is a flow chart for managing a memory of a Java environment in an electronic device according to various embodiments.
[0020] Figure 5 is a flowchart of an application for identifying an abnormally provided object in an electronic device according to various embodiments.
[0021] Figure 6 is a flow chart for providing object occupancy information in an electronic device according to various embodiments.
[0022] Figure 7 is a diagram for explaining an operation of providing object occupancy information according to various embodiments.
[0023] Figure 8 is a flowchart for processing an application providing an abnormal object in an electronic device according to various embodiments.
[0024] Fig. 9 is a diagram for explaining an operation of providing information about an application that performs an abnormal operation according to various embodiments.
[0025] Fig.10 is a flow chart for managing a reference table in an electronic device according to various embodiments.
[0026] Fig.11 is another flow chart for managing a reference table in an electronic device according to various embodiments. DETAILED DESCRIPTION
[0027] Various embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. Also, when describing the embodiments of the present disclosure, when it is judged that the detailed description will unnecessarily obscure the main points of the present disclosure, the detailed description of the relevant known functions or structures will be omitted. Also, the terms described below and the terms defined considering the functions in the present disclosure can be distinguished according to the intention or practice of the user and / or operator, etc. Therefore, the definition should be given based on the content of the full text of this specification.
[0028] Figure 1 1 is a block diagram illustrating an electronic device 101 in a network environment 100 according to various embodiments. Figure 1, the electronic device 101 in the network environment 100 may communicate with the electronic device 102 via the first network 198 (e.g., a short-range wireless communication network), or communicate with the electronic device 104 or the server 108 via the second network 199 (e.g., a long-range wireless communication network). According to an embodiment, the electronic device 101 may communicate with the electronic device 104 via the server 108. According to an embodiment, the electronic device 101 may include a processor 120, a memory 130, an input device 150, a sound output device 155, a display device 160, an audio module 170, a sensor module 176, an interface 177, a haptic module 179, a camera module 180, a power management module 188, a battery 189, a communication module 190, a user identification module (SIM) 196, or an antenna module 197. In some embodiments, at least one of the components (e.g., the display device 160 or the camera module 180) may be omitted from the electronic device 101, or one or more other components may be added to the electronic device 101. In some embodiments, some of the components may be implemented as a single integrated circuit. For example, the sensor module 176 (eg, a fingerprint sensor, an iris sensor, or an illumination sensor) may be implemented to be embedded in the display device 160 (eg, a display).
[0029] The processor 120 may run, for example, software (e.g., program 140) to control at least one other component (e.g., hardware component or software component) of the electronic device 101 connected to the processor 120, and may perform various data processing or calculations. According to one embodiment, as at least part of the data processing or calculation, the processor 120 may load a command or data received from another component (e.g., sensor module 176 or communication module 190) into the volatile memory 132, process the command or data stored in the volatile memory 132, and store the result data in the non-volatile memory 134. According to an embodiment, the processor 120 may include a main processor 121 (e.g., a central processing unit (CPU) or an application processor (AP)) and an auxiliary processor 123 (e.g., a graphics processing unit (GPU), an image signal processor (ISP), a sensor hub processor, or a communication processor (CP)) that is independent of or combined with the main processor 121 in operation. Additionally or alternatively, the auxiliary processor 123 may be adapted to consume less power than the main processor 121, or adapted to be specifically used for a specified function. The auxiliary processor 123 may be implemented separately from the main processor 121 , or as part of the main processor 121 .
[0030] When the main processor 121 is in an inactive (e.g., sleep) state, the auxiliary processor 123 may control at least some of the functions or states related to at least one component (e.g., display device 160, sensor module 176, or communication module 190) among the components of the electronic device 101 (not the main processor 121), or when the main processor 121 is in an active state (e.g., running an application), the auxiliary processor 123 may control at least some of the functions or states related to at least one component (e.g., display device 160, sensor module 176, or communication module 190) among the components of the electronic device 101 together with the main processor 121. According to an embodiment, the auxiliary processor 123 (e.g., an image signal processor or a communication processor) may be implemented as part of another component (e.g., camera module 180 or communication module 190) that is functionally related to the auxiliary processor 123.
[0031] The memory 130 may store various data used by at least one component of the electronic device 101 (e.g., the processor 120 or the sensor module 176). The various data may include, for example, software (e.g., the program 140) and input data or output data for commands related thereto. The memory 130 may include a volatile memory 132 or a non-volatile memory 134.
[0032] The program 140 may be stored as software in the memory 130 , and may include, for example, an operating system (OS) 142 , middleware 144 , or applications 146 .
[0033] The input device 150 may receive commands or data to be used by other components (eg, the processor 120) of the electronic device 101 from outside the electronic device 101 (eg, a user). The input device 150 may include, for example, a microphone, a mouse, or a keyboard.
[0034] The sound output device 155 can output a sound signal to the outside of the electronic device 101. The sound output device 155 may include, for example, a speaker or a receiver. The speaker can be used for general purposes such as playing multimedia or playing records, and the receiver can be used for incoming calls. Depending on the embodiment, the receiver can be implemented as a separate part from the speaker, or as a part of the speaker.
[0035] The display device 160 may visually provide information to the outside of the electronic device 101 (e.g., a user). The display device 160 may include, for example, a display, a holographic device, or a projector, and a control circuit for controlling a corresponding one of the display, the holographic device, and the projector. According to an embodiment, the display device 160 may include a touch circuit adapted to detect a touch or a sensor circuit (e.g., a pressure sensor) adapted to measure the strength of a force caused by a touch.
[0036] The audio module 170 may convert sound into an electrical signal, or vice versa. According to an embodiment, the audio module 170 may obtain sound via the input device 150, or output sound via the sound output device 155 or an earphone of an external electronic device (e.g., electronic device 102) directly (e.g., wired) or wirelessly connected to the electronic device 101.
[0037] The sensor module 176 may detect an operating state (e.g., power or temperature) of the electronic device 101 or an environmental state (e.g., a user's state) outside the electronic device 101, and then generate an electrical signal or data value corresponding to the detected state. According to an embodiment, the sensor module 176 may include, for example, a gesture sensor, a gyro sensor, an atmospheric pressure sensor, a magnetic sensor, an acceleration sensor, a grip sensor, a proximity sensor, a color sensor, an infrared (IR) sensor, a biometric sensor, a temperature sensor, a humidity sensor, or an illumination sensor.
[0038] The interface 177 may support one or more specific protocols that will be used to connect the electronic device 101 directly (e.g., wired) or wirelessly to an external electronic device (e.g., the electronic device 102). According to an embodiment, the interface 177 may include, for example, a high-definition multimedia interface (HDMI), a universal serial bus (USB) interface, a secure digital (SD) card interface, or an audio interface.
[0039] The connection end 178 may include a connector, wherein the electronic device 101 can be physically connected to an external electronic device (e.g., the electronic device 102) via the connector. According to an embodiment, the connection end 178 may include, for example, an HDMI connector, a USB connector, an SD card connector, or an audio connector (e.g., a headphone connector).
[0040] The haptic module 179 may convert the electrical signal into mechanical stimulation (eg, vibration or motion) or electrical stimulation that can be recognized by the user via his sense of touch or kinesthetic sense. According to an embodiment, the haptic module 179 may include, for example, a motor, a piezoelectric element, or an electrical stimulator.
[0041] The camera module 180 may capture still images or moving images. According to an embodiment, the camera module 180 may include one or more lenses, an image sensor, an image signal processor, or a flash.
[0042] The power management module 188 may manage power supply to the electronic device 101. According to an embodiment, the power management module 188 may be implemented as, for example, at least a part of a power management integrated circuit (PMIC).
[0043] The battery 189 may power at least one component of the electronic device 101. According to an embodiment, the battery 189 may include, for example, a non-rechargeable primary battery, a rechargeable secondary battery, or a fuel cell.
[0044] The communication module 190 may support establishing a direct (e.g., wired) communication channel or a wireless communication channel between the electronic device 101 and an external electronic device (e.g., electronic device 102, electronic device 104, or server 108), and perform communication via the established communication channel. The communication module 190 may include one or more communication processors capable of operating independently from the processor 120 (e.g., an application processor (AP)) and supporting direct (e.g., wired) communication or wireless communication. According to an 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 global navigation satellite system (GNSS) communication module) or a wired communication module 194 (e.g., a local area network (LAN) communication module or a power line communication (PLC) module). A corresponding one of these communication modules can communicate with an external electronic device via a first network 198 (e.g., a short-range communication network such as Bluetooth, Wireless Fidelity (Wi-Fi) Direct, or Infrared Data Association (IrDA)) or a second network 199 (e.g., a long-range communication network such as a cellular network, the Internet, or a computer network (e.g., a LAN or a wide area network (WAN))). These various types of communication modules can be implemented as a single component (e.g., a single chip), or these various types of communication modules can be implemented as multiple components separated from each other (e.g., multiple chips). The wireless communication module 192 can identify and authenticate the electronic device 101 in a communication network (such as the first network 198 or the second network 199) using user information (e.g., an International Mobile Subscriber Identity (IMSI)) stored in the user identification module 196.
[0045] The antenna module 197 may transmit or receive a signal or power to or from the outside of the electronic device 101 (e.g., an external electronic device). According to an embodiment, the antenna module 197 may include a plurality of antennas and at least one antenna suitable for a communication scheme used in a communication network (such as the first network 198 or the second network 199) may be selected by, for example, the communication module 190 (e.g., the wireless communication module 192). A signal or power may then be transmitted or received between the communication module 190 and the external electronic device via the selected at least one antenna.
[0046] At least some of the above components may be connected to each other via an inter-peripheral communication scheme (e.g., a bus, a general purpose input output (GPIO), a serial peripheral interface (SPI), or a mobile industry processor interface (MIPI)) and communicatively transmit signals (e.g., commands or data) therebetween.
[0047] According to an embodiment, a command or data may be sent or received between the electronic device 101 and the external electronic device 104 via the server 108 connected to the second network 199. Each of the electronic device 102 and the electronic device 104 may be a device of the same type as the electronic device 101, or a device of a different type from the electronic device 101. According to an embodiment, all or some operations to be run on the electronic device 101 may be run on one or more of the external electronic device 102, the external electronic device 104, or the server 108. For example, if the electronic device 101 should automatically perform a function or service or should perform a function or service in response to a request from a user or another device, the electronic device 101 may request the one or more external electronic devices to perform at least part of the function or service instead of running the function or service, or the electronic device 101 may request the one or more external electronic devices to perform at least part of the function or service in addition to running the function or service. The one or more external electronic devices that receive the request may perform the requested at least part of the function or service, or perform another function or another service related to the request, and transmit the result of the execution to the electronic device 101. The electronic device 101 may provide the result as at least a partial reply to the request with or without further processing the result. To this end, cloud computing technology, distributed computing technology or client-server computing technology may be used, for example.
[0048] Figure 2 2 is a block diagram illustrating a program 140 according to various embodiments. According to an embodiment, the program 140 may include an operating system 210 to control one or more resources of the electronic device 101, a runtime library 220, a native library 230, a middleware 240, or an application 250 that can be run in the operating system 210. The operating system 210 may include, for example, ANDROID TM 、IOS TM , Windows TM , Symbian TM 、Tizen TM or Bada TM For example, at least a portion of program 140 may be preloaded onto electronic device 101 during manufacturing, or may be downloaded from or refined by an external electronic device (e.g., electronic device 102 or 104, or server 108) during user use.
[0049] The operating system 210 may control the management (e.g., allocation or deallocation) of one or more system resources (e.g., processor 120, memory 130, or power (e.g., power management module 188)) of the electronic device 101. Additionally or alternatively, the operating system 210 may include one or more drivers to drive other hardware devices of the electronic device 101, such as the input device 150, the sound output device 155, the display device 160, the audio module 170, the sensor module 176, the interface 177, the tactile module 179, the camera module 180, the power management module 188, the battery 189, the communication module 190, the user identification module 196, or the antenna module 197.
[0050] The runtime library 220 may provide a minimum environment for running at least one application 250. For example, the runtime library 220 may be installed on the operating system 210 and interpret a code developed together with Java and adaptive to the operating system 210. According to an embodiment, as described later by FIG. 3A, the runtime library 220 may run an application (e.g., a Java application) by calling a function (e.g., a native function) stored in the native library 230 or using a function (e.g., a Java function) stored in the runtime library 220 (e.g., a core library). For example, the runtime library 220 may include at least one of a JAVA virtual machine, a Dalvik virtual machine, and / or an Android runtime.
[0051] The native library 230 as an upper layer of the operating system 210 may include a library implemented in C or C+. For example, libraries such as libc, Webkit, SQLite database, etc. may be stored in the native library 230.
[0052] The middleware 240 may provide various functions to the application 250, wherein the application 250 may use functions or information provided from one or more resources of the electronic device 101. For example, the middleware 240 (although not shown) may include an application manager, a window manager, a multimedia manager, a resource manager, a power manager, a database manager, a package manager, a connectivity manager, a notification manager, a location manager, a graphic manager, a security manager, a telephony manager, or a voice recognition manager.
[0053] For example, an application manager can manage the life cycle of an application. For example, a window manager can manage one or more GUI resources used on a screen. For example, a multimedia manager can identify one or more formats necessary for playing a media file, and can encode or decode a corresponding one of the media files using a codec suitable for a corresponding format selected from one or more formats. For example, a resource manager can manage the source code of an application or the space of a memory. For example, a power manager can manage the capacity, temperature, or power of a battery, and determine or provide relevant information necessary for the operation of the electronic device 101 by using corresponding information related to the capacity, temperature, or power of the battery. According to an embodiment, the power manager can interact with a basic input / output system (BIOS) (not shown) of the electronic device 101.
[0054] For example, a database manager may provide, search, or change a database used by application 250. For example, a package manager may manage the installation or refinement of an application distributed in the form of a package file. For example, a connectivity manager may manage a wireless connection or a direct connection between the electronic device 101 and an external electronic device. For example, a notification manager may provide a function of notifying a user of the occurrence of a specific event (e.g., an incoming call, a message, or an alarm). For example, a location manager may manage location information of the electronic device 101. For example, a graphics manager may manage one or more graphic effects to be provided to a user or a user interface associated with one or more graphic effects.
[0055] For example, the security manager can provide system security or user authentication. For example, the phone manager can manage the voice call function or video call function provided by the electronic device 101. For example, the voice recognition manager can send the user's voice data to the server 108, and receive commands corresponding to functions running on the electronic device 101 based at least in part on the voice data from the server 108 or receive text data converted at least in part based on the voice data. According to an embodiment, the middleware 240 can dynamically delete some existing components or add new components. According to an embodiment, at least a portion of the middleware 240 can be included as a part of the operating system 210, or can be implemented as another software separated from the operating system 210.
[0056] For example, application 250 (although not shown) may include a home page, a dialer, SMS / MMS, an instant message (IM), a browser, a camera, an alarm, a contact book, voice recognition, an email, a calendar, a media player, an album, a watch, a health care (e.g., measuring biometric information such as momentum, blood sugar, etc.) or an environmental information (e.g., air pressure, humidity or temperature information measurement) application. According to an embodiment, application 250 may also include an information exchange application capable of supporting information exchange between electronic device 101 and an external electronic device. For example, an information exchange application may include a notification relay application suitable for transmitting specified information (e.g., a call, message or alarm) to an external electronic device, or a device management application suitable for managing an external electronic device. The notification relay application may transmit notification information corresponding to the occurrence of a specified event (e.g., the reception of an email) in another application (e.g., an email application) of electronic device 101 to an external electronic device. Additionally or alternatively, the notification relay application may receive notification information from an external electronic device and provide it to a user of electronic device 101.
[0057] For example, the device management application may control the power (e.g., turning on or off) or function (e.g., brightness, resolution, or focus of the display device 160 or the camera module 180) of an external electronic device or some components thereof (e.g., the display device 160 or the camera module 180) that communicate with the electronic device 101. Additionally or alternatively, the device management application may support the installation, deletion, or refinement of applications running on the external electronic device.
[0058] FIG3A is a block diagram 300 illustrating the runtime library 220 according to various embodiments. In the following description, FIG3B is a diagram 340 for explaining reference information according to various embodiments.
[0059] 3A, the runtime library 220 may be a Java runtime including a Java native interface (JNI) 310, a virtual machine 320, and / or a core library 330. The core library 330 may include a library implemented in Java. This is merely illustrative, and the embodiments of the present disclosure are not limited thereto. For example, the runtime library 220 may omit at least one of the above-mentioned structures or may further add other structures in addition to the above-mentioned structures.
[0060] According to various embodiments, the virtual machine 320 can run various Java components (e.g., application frameworks) present in the middleware 240. According to an embodiment, in response to the application 250 (e.g., a Java application) being run, a memory area required for the run application can be allocated from the operating system 210 to the virtual machine 320. The allocated memory area may include a heap area. This is merely illustrative, and the embodiments of the present disclosure are not limited thereto. For example, the allocated memory area, the runtime data area may also include a method area, a stack area, a native method area, and a PC register.
[0061] According to various embodiments, in response to detecting the supply of the Java object, the virtual machine 320 may store the provided object in the allocated memory area (e.g., the heap area). According to an embodiment, the virtual machine 320 may detect the call of the native function through the JNI 310 during the execution of the Java application 250 (e.g., the Java byte code). In response to the call of the native function, the virtual machine 320 may provide an object corresponding to the function that has been called in the Java application 250 by using the native library 230. The provided object may be provided to the Java application 250 through the JNI 310. Conversely, the virtual machine 320 may provide an object by using the core library 330 and provide the provided object to the native library 230 through the JNI 310.
[0062] According to various embodiments, the virtual machine 320 may provide reference information related to the provided object. For example, the virtual machine 320 may provide reference information indicating the thread that has provided the object. For another example, in response to a first object stored in a heap area using a variable associated with a second object, the virtual machine 320 may provide reference information indicating that the first object and the second object are mutually reachable objects. The reference information may be stored in the form of a table having a previously specified size. For example, the reference table may include reference information for a specified number (e.g., 51,200).
[0063] According to an embodiment, as shown in FIG. 3B , reference information 342 may be divided into local references (L / R) and global references (G / R). This is merely illustrative, and embodiments of the present disclosure are not limited thereto. Local references (L / R) are reference information related to objects that can only be used in one thread (e.g., a thread to which the object has been provided) among objects 344 stored in the heap area. Global references (G / R) are reference information related to objects that can be used in multiple threads among objects 344 stored in the heap area.
[0064] According to various embodiments, based on the provided reference information, the virtual machine 320 may identify an application that abnormally provides an object. For example, the virtual machine 320 may identify an application that provides an overflow of a reference table.
[0065] According to an embodiment, as later by Figures 5 to 7 As described, in order to identify an application that abnormally provides an object, the virtual machine 320 can provide possession information related to the provided object. The possession information can include information about the application related to the thread that has provided the object. For example, in response to the references stored in the reference table exceeding a specified first standard value (e.g., 40,000), the virtual machine 320 can start providing possession information. The possession information can be provided until the number of references stored in the reference table exceeds a second standard value (e.g., 50,000).
[0066] According to an embodiment, the virtual machine 320 may analyze the application information (e.g., an application that has provided 10,000 objects) included in the provided occupancy information to identify an application that abnormally provides objects. For example, the virtual machine 320 may identify an application that has provided objects, and identify an application that has provided the most objects. For another example, the virtual machine 320 may identify an application that has provided objects, and identify at least one application that has provided a specified number or more of objects.
[0067] According to various embodiments, the virtual machine 320 may notify information related to the application of the abnormal providing object. The information about the application may include at least one of the application ID, the application name, or the application version information. For example, the application information may be provided to the operating system 210. The application information provided to the operating system 210 may be used by the electronic device 101. For example, the application information may be output by the display device 160 of the electronic device 101. In another example, the application information may be sent to an application server (e.g., server 108). In this case, the application server may perform error analysis on the corresponding application.
[0068] The electronic device ( Figure 1 The electronic device 101 may be a device of various forms. The electronic device may include, for example, a portable communication device (e.g., a smart phone), a computer device, a portable multimedia device, a portable medical device, a camera, a wearable device, or a household appliance. The electronic device of the embodiments of this document is not limited to the above devices.
[0069] It should be understood that the various embodiments of this document and the terms used therein are not intended to limit the technical features set forth herein to specific embodiments, but include various changes, equivalent forms or alternative forms for the corresponding embodiments. For the description of the accompanying drawings, similar reference numerals may be used to refer to similar or related elements. Unless otherwise clearly indicated by the relevant context, the nouns in the singular form corresponding to the term may include one or more items. In this document, each of the phrases such as "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" may include all possible combinations of items listed together with the corresponding one of the multiple phrases. Terms such as "first" and "second" or "the first" and "the second" may be used to simply distinguish the corresponding component from another corresponding component, and do not limit the corresponding component on the other hand (e.g., importance or order). If any element (e.g., a first element) is referred to as being “coupled to”, “coupled to”, “connected to”, “connected to”, or “connected to” another element (e.g., the second element), with or without the terms “operably” or “communicatively” being used, it means that the element may be directly (e.g., wired) coupled to the other element, wirelessly coupled to the other element, or coupled to the other element via a third element.
[0070] The term "module" used in this document may include a unit implemented in hardware, software, or firmware, and may be used interchangeably with terms such as "logic", "logic block", "part", "circuit", etc. A module may be a single integrated part suitable for performing one or more functions or a minimum unit of the part or a portion thereof. For example, according to an embodiment, a module may be implemented in the form of an application specific integrated circuit (ASIC).
[0071] Various embodiments of this document may be implemented as software (e.g., program 140) that includes one or more instructions stored in a machine (e.g., electronic device 101) readable storage medium (e.g., internal memory 136 or external memory 138). For example, a processor (e.g., processor 120) of a machine (e.g., electronic device 101) may call at least one of the one or more instructions stored in the storage medium and execute the called instruction. This enables the machine to operate to perform at least one function according to at least one of the called instructions. One or more instructions may include code provided by a compiler or code that can be executed by an interpreter. The machine-readable storage medium may be provided in the form of a non-transitory storage medium. Among them, the term "non-transitory" only means that the storage medium is a tangible device and does not include signals (e.g., electromagnetic waves), but the term does not distinguish between data being semi-permanently stored in the storage medium and data being temporarily stored in the storage medium.
[0072] According to an embodiment, the method according to various embodiments disclosed in this document may be included and provided in a computer program product. The computer program product may be traded between a seller and a buyer as a product. The computer program product may be published in the form of a machine-readable storage medium (e.g., a compact disk read-only memory (CD-ROM)), or may be published online (e.g., downloaded or uploaded) via an application store (e.g., Play StoreTM), or may be published (e.g., downloaded or uploaded) directly between two user devices (e.g., smart phones). If published online, at least a portion of the computer program product may be at least temporarily stored or temporarily provided in a machine-readable storage medium (such as a memory of a manufacturer's server, an application store's server, or a relay server).
[0073] According to various embodiments, each component (e.g., module or program) in the above-mentioned components may include a single entity or multiple entities. According to various embodiments, one or more of the above-mentioned components or operations may be omitted, or one or more other components or operations may be added. Alternatively or additionally, multiple components (e.g., modules or programs) may be integrated into a single component. In this case, the integrated component may still perform the one or more functions of each component in the multiple components in the same or similar manner as one or more functions of each component are performed by a corresponding component before integration. According to various embodiments, the operations performed by a module, a program or another component may be performed sequentially, in parallel, repeatedly or in a tentative manner, or one or more operations in the operations may be run or omitted in a different order, or one or more other operations may be added.
[0074] According to various embodiments, an electronic device (e.g., electronic device 101) may include a processor (e.g., processor 120) and a memory (e.g., memory 130) electrically connected to the processor. The memory may be configured to store a plurality of Java application programs (e.g., application 250), and may store instructions that, when executed, cause the processor to execute a virtual machine (e.g., virtual machine 320) configured to execute at least one Java application stored in the memory. According to an embodiment, in response to detecting the supply of an object during the execution of a Java application, the virtual machine executed by the processor may provide a reference to the provided object, and identify an application that has provided a threshold or more objects based on the provided reference, and provide information related to the identified application to the processor.
[0075] According to various embodiments, the virtual machine may monitor the number of global references.
[0076] According to various embodiments, in response to the number of references exceeding a first threshold, the virtual machine may monitor objects provided at a specified count and identify at least one application related to the provided objects. According to an embodiment, the virtual machine may monitor objects provided until the number of references exceeds a second threshold.
[0077] According to various embodiments, the virtual machine may store application information related to the provided object. According to an embodiment, the application information may include at least one of an application ID, an application name, or application version information.
[0078] According to various embodiments, the virtual machine may identify at least one reference satisfying a condition among the provided references, and delete the identified at least one reference.
[0079] According to various embodiments, the virtual machine may provide an additional area different from the area in which the provided reference has been stored, and move the identified at least one reference to the additional area.
[0080] According to various embodiments, the instructions may be configured to end execution of the identified application.
[0081] According to various embodiments, the instructions may be configured to delete the identified application.
[0082] According to various embodiments, the instructions may be configured to provide the identified application to another electronic device.
[0083] Figure 4 4 is a flow chart 400 for managing a memory of a Java environment in an electronic device according to various embodiments. In the following embodiments, the operations may be performed sequentially, but not necessarily sequentially. For example, the order of the operations may also be changed, and at least two operations may also be performed in parallel. Figure 4An electronic device can be Figure 1 Electronic device 101.
[0084] Reference Figure 4 In operation 410, the electronic device of various embodiments (e.g., the virtual machine 320 of FIG. 3) may monitor a reference table provided by the operation of the virtual machine 320. The reference table may include global references to objects that may be used in many threads among objects stored in the heap area of the runtime library 220. According to an embodiment, the virtual machine 320 may perform a monitoring operation corresponding to the execution of at least one application (e.g., a Java application). However, this is merely illustrative, and the present disclosure is not limited thereto. For example, the monitoring operation may be performed during the operation of the application, or may also be performed corresponding to the end of the operation of the application.
[0085] In operation 420, the electronic device (eg, virtual machine 320) of various embodiments may identify whether a previously specified threshold or more objects have been provided. The number of objects may be analyzed as the number of references stored in the reference table.
[0086] According to various embodiments, in response to providing objects less than a previously specified threshold, the electronic device (eg, virtual machine 320 ) may monitor the number of provided objects. The monitoring operation may include at least one of operations 410 and 420 .
[0087] According to various embodiments, in response to identifying that a previously specified threshold or more objects are provided, the electronic device (e.g., virtual machine 320) can identify an application that abnormally provides the object. For example, virtual machine 320 can designate an application that has provided a threshold or more objects as an application that abnormally provides the object.
[0088] In operation 440, the electronic device (e.g., virtual machine 320) of various embodiments may provide information related to an application that abnormally provides an object. The virtual machine 320 may provide information related to an application that provides the most objects. For another example, the virtual machine 320 may provide information related to an application that has provided a threshold or more objects. The information about the application may be provided to at least one of the operating system 210 or the processor 120. For example, the information about the application may include at least one of an application ID, an application name, or application version information.
[0089] Figure 5 5 is a flowchart 500 of an application for identifying an abnormally provided object in an electronic device according to various embodiments. In the following description, Figure 7 is a diagram for explaining an operation of providing object occupancy information according to various embodiments. Figure 5 Operational representation Figure 4Various embodiments of operations 410 to 430 of the present invention are described below. In the following embodiments, the operations may be performed sequentially, but not necessarily sequentially. For example, the order of the operations may also be changed, and at least two operations may also be performed in parallel. Figure 5 An electronic device can be Figure 1 Electronic device 101.
[0090] Reference Figure 5 In operation 510, the electronic device of various embodiments (e.g., the virtual machine 320 of FIG. 3 ) may detect object provision or non-provision. Object provision may be related to calling a native function in a Java application. For example, in response to detecting a call to a native function through JNI 310, the virtual machine 320 may determine that object provision has been detected. In addition, the virtual machine 320 may use the native library 230 to provide an object corresponding to the function called in the Java application 250, and provide it to the Java application 250 through JNI 310.
[0091] In operation 520, the electronic device (e.g., virtual machine 320) of various embodiments may provide reference information about the provided object. The reference information may prevent the provided object from being eliminated by garbage collection. For example, the reference information may include information about the target (e.g., a thread, another object, etc.) referenced by the provided object.
[0092] In operation 530, the electronic device (e.g., virtual machine 320) of various embodiments may determine whether the monitoring operation of the application providing the object is running or not running. The monitoring operation or not running may be determined by comparing the number of refined references and the first standard value. The first standard value is a value used to determine whether the monitoring operation or not running of the application providing the object is running. For example, in response to the number of refined references exceeding the first standard value, the virtual machine 320 may determine that the monitoring operation condition has been met. This is merely illustrative, and the embodiments of the present disclosure are not limited thereto. For example, the virtual machine 320 may also determine whether the monitoring operation or not running is based on the number of objects stored in the heap area.
[0093] According to various embodiments, in response to determining that the monitoring operation is not executed, the electronic device (e.g., virtual machine 320) may repeatedly perform the operation of determining whether the monitoring operation is executed or not executed. For example, the operation of determining whether the operation is executed or not executed may include at least one of operations 510 to 530.
[0094] According to various embodiments, in response to determining that the monitoring is running, in operation 540, the electronic device (e.g., virtual machine 320) may determine the analysis or non-analysis of the monitoring result. The analysis or non-analysis of the monitoring result may be determined by comparing the number of refined references and the second standard value. The second standard may have a value greater than the first standard value and a value less than the maximum storage number of reference information. For example, in response to the number of refined references exceeding the second standard value, the virtual machine 320 may analyze the monitoring result. By analyzing the monitoring result, the virtual machine 320 may identify the application of the abnormally provided object.
[0095] According to various embodiments, after performing the monitoring operation until the monitoring result is analyzed, the electronic device (e.g., the virtual machine 320) may provide object occupancy information in operation 550. The object occupancy information may include information related to the application that provides the object or thread. Figure 7 As shown in , at a time point when the number of objects stored in the heap area exceeds a first standard value, occupancy information may be provided (710). In addition, in response to objects accumulating in the heap area, occupancy information corresponding to the accumulated objects may also be accumulated. In addition, the occupancy information may be accumulated and provided until the number of objects stored in the heap area exceeds a second standard value (720).
[0096] According to various embodiments, in response to analyzing the monitoring result, in other words, in response to the previously specified number or more of occupancy information being accumulated, the electronic device (e.g., the virtual machine 320) may analyze the object occupancy information in operation 560. For example, the virtual machine 320 may call a function for identifying at least one of an application ID, an application name, or an application version information.
[0097] In operation 570 , the electronic device (eg, the virtual machine 320 ) of various embodiments may identify an application that abnormally provides an object based on the analysis result of the object occupancy information.
[0098] Figure 6 is a flowchart 600 for providing object occupancy information in an electronic device according to various embodiments. Figure 6 Operational representation Figure 5 In the following embodiments, the operations may be performed sequentially, but not necessarily sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel. Figure 6 An electronic device can be Figure 1 Electronic device 101.
[0099] Reference Figure 6In operation 610, the electronic device of various embodiments (e.g., the virtual machine 320 of FIG. 3 ) may perform monitoring of the refined reference table. The virtual machine 320 may monitor the number of references stored in the reference table. For example, the monitoring target may include global reference information. As described above, it may also be determined based on the number of objects stored in the heap area whether the monitoring is running or not. Therefore, the virtual machine 320 may also monitor the number of refined objects.
[0100] In operation 620, the electronic device (e.g., virtual machine 320) of various embodiments may determine whether the number of references stored in the reference table is reduced to be less than a first standard value. As described above, the first standard value is a value for determining the execution or non-execution of the monitoring operation for the application providing the object, in other words, the supply or non-supply of the supply information related to the provided object.
[0101] According to various embodiments, in response to the number of stored references decreasing to be less than the first standard value, the electronic device (e.g., virtual machine 320) may determine that the number of references has decreased to the extent that an overflow of the reference table is not provided in operation 630, and corresponding to the determination, the electronic device may stop the operation of providing the occupancy information. For example, the virtual machine 320 may discard the provided object occupancy information.
[0102] According to various embodiments, in response to the number of stored references not being reduced to be less than the first standard value, the electronic device (e.g., the virtual machine 320) may refine the object occupancy information in operation 640. For example, the virtual machine 320 may determine that there is a possibility of overflow of the provided reference table, and continuously provide occupancy information related to the provided object.
[0103] According to various embodiments, the first standard value and the second standard value associated with the provision of the provision information and the time point at which the provision of the provision information is completed may be fixed values. However, this is merely illustrative, and the present disclosure is not limited thereto. For example, in response to repeatedly increasing and decreasing the number of objects by the standard of the first standard value, the provision and discard of the occupancy information may occur repeatedly, and thus affect the performance of the virtual machine 320. Therefore, the first standard value and the second standard value may be dynamically changed based on the memory usage capacity, the number of applications running or installed, the storage history of the object, etc.
[0104] Figure 8 800 is a flowchart for processing an application providing an abnormal object in an electronic device according to various embodiments. In the following description, Fig. 9 is a diagram 900 for explaining an operation of providing information related to an application performing an abnormal operation according to various embodiments. Figure 8 Operational representation Figure 4In the following embodiments, the operations may be performed sequentially, but not necessarily sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel. Figure 8 An electronic device can be Figure 1 Electronic device 101.
[0105] Reference Figure 8 In operation 810, an electronic device (eg, Figure 1 The processor 120 of the embodiment may request an instruction for processing an application. The application may include an application that has a possibility of providing an overflow of a reference table. For example, the application may include an application that abnormally repeatedly provides an object. According to an embodiment, the processor 120 may receive information about the application from the virtual machine 320. For example, the processor 120 may process to output the received information about the application through the display device 160. For example, the information about the application may be output in the form of a pop-up window. For example, Fig. 9 As shown in , the information 900 output by the display device 160 may include information related to the abnormally operated application (e.g., name, version, ID, etc.), and a menu (e.g., an end menu and / or a delete menu) 910 specifying a solution for processing the application, etc.
[0106] In operation 820, the electronic device (eg, Figure 1 The processor 120 of the electronic device may determine whether it receives an instruction specifying a first solution or an instruction specifying a second solution. The first solution may be a solution for ending the operation of an application that has a possibility of providing an overflow of the reference table. The second solution may be a solution for deleting an application that has a possibility of providing an overflow of the reference table from the electronic device.
[0107] According to various embodiments, in response to receiving the instruction to specify the first scheme, in operation 830, the electronic device (eg, the processor 120) may end the operation of the application.
[0108] According to various embodiments, in response to receiving the instruction to specify the second scheme, in operation 840, the electronic device (eg, the processor 120) may delete the application from the electronic device.
[0109] Fig.10 is a flowchart 1000 for managing a reference table in an electronic device according to various embodiments. Fig.10 Operational representation Figure 4 In the following embodiments, the operations may be performed sequentially, but not necessarily sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel. Fig.10An electronic device can be Figure 1 Electronic device 101.
[0110] Reference Fig.10 In operation 1010, the electronic device of various embodiments (e.g., the virtual machine 320 of FIG. 3 ) may determine at least one reference that satisfies a condition among the references stored in the reference table. The determined reference may be a target to be deleted from the reference table. According to an embodiment, the virtual machine 320 may specify a deletion target based on the time when the reference is provided. For example, at least one reference whose provision time exceeds a threshold may be designated as a deletion target. This is merely illustrative, and the embodiments of the present disclosure are not limited thereto. For example, unlike the above-described embodiments, the virtual machine 320 may maintain at least one application whose provision time exceeds a threshold, and also designate at least one application whose provision time does not exceed the threshold as a deletion target.
[0111] In operation 1020, the electronic device (e.g., virtual machine 320) of various embodiments may delete at least one reference determined as a deletion target from the reference table. For example, virtual machine 320 may identify an object corresponding to the reference determined as a deletion target and return a function to which the identified object has been provided, thereby performing a deletion operation.
[0112] As mentioned above, Fig.10 An embodiment of deleting at least one reference satisfying a condition from a reference table to prevent overflow of the reference table has been explained. According to various embodiments, the electronic device 101 may prevent overflow of the reference table by deleting a satisfying object among objects stored in the heap area in a scheme that is the same or similar to the above scheme.
[0113] Fig.11 is a flowchart 1100 for managing a reference table in an electronic device according to various embodiments. Fig.11 Operational representation Figure 4 In the following embodiments, the operations may be performed sequentially, but not necessarily sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel. Fig.11 An electronic device can be Figure 1 Electronic device 101.
[0114] Reference Fig.11, in operation 1110, the electronic device of various embodiments (e.g., the virtual machine 320 of FIG. 3 ) may determine at least one reference that satisfies a condition among the references stored in the reference table. The determined reference may be a target to be moved to another storage space. According to an embodiment, the virtual machine 320 may specify a moving target based on the time at which the reference is provided. For example, at least one reference whose provision time exceeds a threshold may be designated as a moving target. This is merely illustrative, and the embodiments of the present disclosure are not limited thereto. For example, unlike the above-described embodiments, the virtual machine 320 may maintain at least one reference whose provision time exceeds a threshold, and further designate at least one reference whose provision time does not exceed the threshold as a moving target.
[0115] In operation 1120, the electronic device (e.g., virtual machine 320) of various embodiments may move at least one reference determined as a move target to another storage space. For example, virtual machine 320 may provide an additional heap area different from the heap area in which the reference table has been stored, and move at least one reference determined as a move target to the provided additional heap area.
[0116] The operating method of an electronic device (e.g., electronic device 101) of various embodiments may include running a Java application (e.g., application 250) through a virtual machine (e.g., virtual machine 320), and in response to occupancy of an object detected during the running of the Java application, providing a reference to the provided object, and identifying an application that has provided a threshold or more of the object based on the provided reference, and providing information related to the identified application.
[0117] According to various embodiments, the provided reference may include a global reference.
[0118] According to various embodiments, identifying an application may include: in response to the number of references exceeding a first threshold, monitoring an object provided with a specified count; and identifying at least one application related to the provided object. According to an embodiment, monitoring the object may be performed until the number of references exceeds a second threshold.
[0119] According to various embodiments, monitoring the object may include storing application information related to the provided object. According to an embodiment, the application information may include at least one of an application ID, an application name, or application version information.
[0120] According to various embodiments, providing the information related to the identified application may include identifying at least one reference satisfying a condition among the provided references, and deleting the identified at least one reference.
[0121] According to various embodiments, providing the information related to the identified application may include providing an additional area different from an area where the provided reference has been stored, and moving the identified at least one reference to the additional area.
[0122] According to various embodiments, providing information related to the identified application may include ending execution of the identified application.
[0123] According to various embodiments, providing information related to the identified application may include deleting the identified application.
[0124] According to various embodiments, providing the information related to the identified application may include providing the identified application to another electronic device.
[0125] At the same time, various embodiments of the present disclosure have been described, but various modifications can be made without departing from the scope of the various embodiments of the present disclosure. Therefore, the scope of the various embodiments of the present disclosure should not be limited to the described embodiments, and should not be limited by the described embodiments, and should be limited not only by the claims described later, but also by the equivalents of these claims.
Claims
1. Electronic equipment, including: processor; as well as a memory electrically connected to the processor, wherein the memory is configured to store a plurality of Java applications and to store instructions which, when executed, cause the processor to execute a virtual machine configured to execute at least one Java application stored in the memory, and In response to detecting that an object has been generated during execution of the Java application, the virtual machine executed by the processor generates a reference to the generated object, identifies an application that has generated a number of objects exceeding a specified threshold based on the generated reference, and provides information related to the identified application to the processor.
2. The electronic device according to claim 1, wherein: The virtual machine monitors the number of global references among the generated references.
3. The electronic device according to claim 1, wherein: In response to the number of references exceeding a first threshold, the virtual machine monitors objects generated with a specified count and identifies at least one application associated with the generated objects.
4. The electronic device according to claim 3, wherein: The virtual machine monitors objects generated before the number of references exceeds a second threshold.
5. The electronic device according to claim 3, wherein: The virtual machine stores application information related to the generated object, and The application information includes at least one of an application ID, an application name, or application version information.
6. The electronic device according to claim 1, wherein: The virtual machine identifies at least one reference satisfying a condition among the generated references, and deletes the identified at least one reference.
7. The electronic device according to claim 1, wherein: The virtual machine generates an additional area different from an area where the generated reference has been stored, and moves the identified at least one reference to the additional area.
8. The electronic device according to claim 1, wherein: The instructions process the identified application, and The processing of the identified application includes at least one of ending the execution of the identified application, deleting the identified application, or transmitting the identified application to another electronic device.
9. A method for managing memory in a Java runtime environment, comprising: Run Java applications through a virtual machine; In response to detecting that an object is generated during execution of the Java application, generating a reference to the generated object; identifying, based on the generated references, an application that has generated a number of objects exceeding a specified threshold; and Provides information about the identified application.
10. The method according to claim 9, wherein: Identifying the application includes: In response to the number of references exceeding a first threshold, monitoring objects generated with a specified count; and At least one application related to the generated object is identified. The method of claim 10 , further comprising monitoring generation of the object until the number of references exceeds a second threshold.
12. The method according to claim 11, wherein: Monitoring the object includes storing application information associated with the generated object, and The application information includes at least one of an application ID, an application name, or application version information.
13. The method according to claim 9, wherein: Provides information about the identified application including: identifying at least one reference among the generated references that satisfies a condition; and Delete at least one identified reference.
14. The method according to claim 9, wherein: Provides information about the identified application including: generating an additional region different from the region in which the generated references are stored; and The identified at least one reference is moved to the additional area.
15. The method of claim 9, further comprising processing the identified application, in, The processing of the identified application includes at least one of ending the execution of the identified application, deleting the identified application, or transmitting the identified application to another electronic device.
Citation Information
Patent Citations
Methods and systems for extending the object store of an application virtual machine
CN106104477A
Extending virtual machine instruction set architecture
CN108139896A