Apparatus and method for managing memory
The memory management device addresses memory errors by calculating and managing buffer sizes based on the number of applications, ensuring efficient and error-free memory allocation for multiple API calls.
Patent Information
- Application Number
- PCT/KR2025/095162
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-05
- Filing Date
- 2025-04-04
- Publication Date
- 2025-10-09
AI Technical Summary
Memory errors, such as memory leaks, occur when multiple applications call the same application programming interface (API) due to simultaneous buffer allocation exceeding memory capacity.
A memory management device and method that includes an interpretation unit to calculate buffer sizes based on the number of user applications and a memory management unit to allocate and release buffers accordingly, preventing redundant allocation and ensuring efficient use of memory resources.
Prevents memory errors by dynamically allocating and releasing buffers based on the number and usage cycle of applications, thereby optimizing memory usage even when multiple applications call the same API.
Smart Images

Figure KR2025095162_09102025_PF_FP_ABST
Abstract
Description
Memory management device and method
[0001] The present invention relates to a memory management device and method, and more particularly, to a memory management device and method for solving a memory problem that may occur when the same application programming interface (API) is called by multiple applications.
[0002] A network camera can transmit captured images of a subject via a network. To this end, the network camera may include an image capturing means and a communication means.
[0003] Network cameras can perform various actions in response to commands received from users. Network cameras may be equipped with application programming interfaces (APIs) for various actions. Furthermore, network cameras may include at least one application that calls the API to perform specific functions. Users can use the application to instruct the network camera to perform specific actions.
[0004] When an application calls an API, a buffer for the API's operation may be allocated in memory. However, if multiple applications call the same API, memory errors, such as memory leaks, can occur. Simultaneous buffer allocation for multiple applications can exceed memory capacity.
[0005] Therefore, there is a need for an invention that enables preventing memory errors from occurring through buffer allocation even when multiple applications call the same API.
[0006] The problem to be solved by the present invention is to provide a memory management device and method that solves a memory problem that may occur when the same application programming interface (API) is called by multiple applications.
[0007] The objects of the present invention are not limited to the objects mentioned above, and other objects not mentioned will be clearly understood by those skilled in the art from the description below.
[0008] In order to achieve the above task, a memory management device according to an embodiment of the present invention includes an interpretation unit that receives a call command of an application programming interface (API) from at least one user application, calculates a size of a buffer for use of an API corresponding to the call command by referring to the number of the at least one user application, and a memory management unit that allocates a buffer corresponding to the calculated size to memory.
[0009] The size of the buffer for use of the API corresponding to the above call command includes a size corresponding to the number of unit buffers allocated to enable one user application to use the API corresponding to the above call command, and the number of at least one user application is allocated.
[0010] The number of at least one user application includes the number of user applications installed in the storage.
[0011] The number of at least one user application includes the number of user applications loaded into memory.
[0012] The number of at least one user application includes the number of user applications that can access the API.
[0013] The above memory management unit releases a buffer allocated to the memory for use of the API when use of the API by at least one user application is terminated.
[0014] The above call command includes a usage cycle of the API, and the memory management unit allocates a buffer corresponding to the calculated size to the memory according to the usage cycle.
[0015] The above memory management unit repeats the allocation and release of a buffer corresponding to the calculated size according to the above usage cycle.
[0016] The above memory management unit releases the allocation of the buffer corresponding to the calculated size at a point in time when a preset usage time has elapsed from the point in time when the buffer corresponding to the calculated size was allocated.
[0017] A memory management method according to an embodiment of the present invention includes the steps of receiving a call command of an application programming interface (API) from at least one user application, calculating a size of a buffer for use of an API corresponding to the call command by referring to the number of the at least one user application, and allocating a buffer corresponding to the calculated size to memory.
[0018] The size of the buffer for use of the API corresponding to the above call command includes a size corresponding to the number of unit buffers allocated to enable one user application to use the API corresponding to the above call command, as many as the number of user applications.
[0019] The number of at least one user application includes the number of user applications installed in the storage.
[0020] The number of at least one user application includes the number of user applications loaded into memory.
[0021] The number of at least one user application includes the number of user applications that can access the API.
[0022] When the use of the API by at least one user application is terminated, the buffer allocated to the memory for the use of the API is released.
[0023] The above call command includes the usage cycle of the API, and a buffer corresponding to the calculated size is allocated to the memory according to the usage cycle.
[0024] Allocation and release of a buffer corresponding to the calculated size is repeated according to the above usage cycle.
[0025] When a pre-set usage time has elapsed from the time when the buffer corresponding to the calculated size is allocated, the allocation of the buffer corresponding to the calculated size is released.
[0026] Specific details of other embodiments are included in the detailed description and drawings.
[0027] According to the memory management device and method of the present invention as described above, each time an API is called, a number of buffers corresponding to a plurality of applications installed on the device are allocated to the memory, thereby preventing the occurrence of memory errors through buffer allocation even when multiple applications call the same API.
[0028] The effects of the present invention are not limited to the effects mentioned above, and other effects not mentioned will be clearly understood by those skilled in the art from the description of the claims.
[0029] FIG. 1 is a block diagram of a memory management device according to an embodiment of the present invention.
[0030] Figure 2 is a block diagram of the analysis unit shown in Figure 1.
[0031] Figure 3 is a drawing for explaining the operation of the call receiving unit.
[0032] Figure 4 is a diagram showing multiple user applications calling the same API.
[0033] Figure 5 is a diagram for explaining the operation of the memory management unit.
[0034] Figure 6 is a diagram illustrating how a user application operates using a buffer allocated in memory.
[0035] Figure 7 is a diagram to explain how buffers are allocated for each API by the memory management unit.
[0036] Figure 8 is a diagram to explain that a buffer is allocated periodically.
[0037] Figure 9 is a diagram showing a call command.
[0038] Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the attached drawings. The advantages and features of the present invention, and methods for achieving them, will become clear with reference to the embodiments described in detail below together with the attached drawings. However, the present invention is not limited to the embodiments disclosed below, but can be implemented in various different forms. These embodiments are provided only to ensure that the disclosure of the present invention is complete and to fully inform those skilled in the art of the scope of the invention, and the present invention is defined only by the scope of the claims. Like reference numerals refer to like elements throughout the specification.
[0039] Unless otherwise defined, all terms (including technical and scientific terms) used herein may be used in their common sense to those of ordinary skill in the art to which the present invention pertains. Furthermore, terms defined in commonly used dictionaries are not to be interpreted ideally or excessively unless explicitly and specifically defined otherwise.
[0040] FIG. 1 is a block diagram of a memory management device according to an embodiment of the present invention.
[0041] Referring to FIG. 1, a memory management device (10) according to an embodiment of the present invention is configured to include an imaging unit (100), storage (200), memory (300), processor (400), analysis unit (500), memory management unit (600), and communication unit (700).
[0042] The imaging unit (100) can capture a subject and generate an image of the subject. For example, the memory management device (10) according to an embodiment of the present invention may be a network camera that generates and transmits an image of the subject. However, the memory management device (10) of the present invention is not limited to a network camera, and various devices that process the image generated by the imaging unit (100) may correspond to the memory management device (10) of the present invention. The imaging unit (100) may include an optical unit (not shown) and an image sensor (not shown). The optical unit receives light from the subject, and the image sensor can generate an image using the light input through the optical unit. For example, a charge-coupled device (CCD) or a complementary metal-oxide semiconductor (CMOS) device may serve as the image sensor. The image generated by the imaging unit (100) in the present invention may be a moving image or a still image.
[0043] The storage (200) can temporarily or permanently store computer programs, instructions, data, and information necessary for the operation of the memory management device (10). For example, the storage (200) can store images generated by the imaging unit (100). In addition, the storage (200) can store at least one user application. The user application can be a computer program that performs operations necessary for the operation of the memory management device (10). For example, the user application can perform an operation of storing an image generated by the imaging unit (100) in the storage (200) or transmitting it via the communication unit (700).
[0044] Storage (200) may be implemented in the form of a non-volatile storage device such as Read Only Memory (ROM), Erasable Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), flash memory, hard disk, or removable disk. Storage (200) may include any form of non-transitory computer-readable recording medium well known in the art of the present invention.
[0045] The memory (300) can temporarily store computer programs, instructions, data, and information necessary for the operation of the memory management device (10). For example, at least one user application can be loaded into the memory (300). Additionally, the memory (300) can provide a buffer usable by at least one user application. The memory (300) can be implemented in the form of a volatile storage device such as RAM (Read Access Memory).
[0046] The processor (400) can perform overall control over the imaging unit (100), storage (200), memory (300), analysis unit (500), memory management unit (600), and communication unit (700). For example, the processor (400) can execute a computer program loaded into the memory (300). The computer program can include a user application. In addition, the computer program can include an analysis unit (500) and a memory management unit (600). The processor (400) can be provided in a form including at least one of a CPU (Central Processing Unit), an MPU (Micro Processor Unit), an MCU (Micro Controller Unit), and a GPU (Graphics Processor Unit). The memory management unit (600) of the present invention can include at least one processor (400).
[0047] The analysis unit (500) can calculate the size of the buffer required for use by the user application. The user application can operate using the buffer allocated to the memory (300). A detailed description of the analysis unit (500) will be provided later with reference to FIGS. 2 to 4.
[0048] The memory management unit (600) can allocate a buffer corresponding to the size calculated by the analysis unit (500) to the memory (300). The user application can operate using the buffer of the memory (300) allocated by the memory management unit (600).
[0049] The interpretation unit (500) and the memory management unit (600) may be provided in the form of a computer program and stored in the storage (200). The interpretation unit (500) and the memory management unit (600) may be loaded into the memory (300) and executed by the processor (400).
[0050] The communication unit (700) can transmit results according to the operation of the user application. For example, the user application can issue a command for transmitting an image generated by the imaging unit (100). The communication unit (700) can transmit the image according to the command. In addition, the communication unit (700) can also receive various data and information necessary for the operation of the memory management device (10).
[0051] Fig. 2 is a block diagram of the interpretation unit illustrated in Fig. 1, Fig. 3 is a drawing for explaining the operation of the call reception unit, and Fig. 4 is a drawing showing multiple user applications calling the same API.
[0052] Referring to FIG. 2, the interpretation unit (500) is configured to include a call receiving unit (510) and a buffer size calculation unit (520).
[0053] The call receiving unit (510) can receive a call command of an application programming interface (API) (900) (hereinafter referred to as API) from at least one user application.
[0054] Referring to FIG. 3, a user application (800) can call an API (900) to execute an embedded application (not shown) connected to the API (900).
[0055] The memory management device (10) can provide multiple APIs (900) that allow access by the user application (800). That is, the memory management device (10) provides multiple open APIs. The user application (800) can perform unique operations by executing an embedded application through the API (900). FIG. 3 illustrates that user application 1 calls API b, user application 2 calls API M, and user application N calls API a.
[0056] The call receiving unit (510) can receive a call command from each user application (800). The call command may include identification information of the API (900). Referring to FIG. 3, the call command of user application 1 may include identification information of API b.
[0057] Referring again to FIG. 2, the buffer size calculation unit (520) can calculate the size of a buffer corresponding to a call command of a user application (800). In order for the user application (800) to use the API (900), a buffer corresponding to the API (900) may need to be allocated in the memory (300). The buffer size calculation unit (520) can calculate the size of a buffer required for the user application (800) to use the API (900).
[0058] The user application (800) can freely call multiple APIs (900) provided by the memory management device (10). For example, the user application (800) may simultaneously call multiple APIs (900) among the entire APIs (900). During this process, multiple user applications (800) may simultaneously call the same API (900). Fig. 4 illustrates user application 1 and user application 2 calling API b simultaneously. If multiple applications call the same API (900) simultaneously, memory errors such as memory invasion may occur.
[0059] In order to prevent the occurrence of such a memory error, the buffer size calculation unit (520) can calculate the size of the buffer for use of the API (900) corresponding to the call command by referring to the number of at least one user application (800). Here, the size of the buffer for use of the API (900) corresponding to the call command may include a size corresponding to the number of unit buffers (1010) (see FIG. 5) allocated to enable one user application (800) to use the API (900) corresponding to the call command, which is allocated to at least one user application (800). For example, if the size of the unit buffer (1010) allocated to enable one user application (800) to use the API (900) corresponding to the call command is 4 bytes, and the number of user applications (800) is 8, the buffer size calculation unit (520) can calculate a buffer size of 32 bytes. In other words, even if one of multiple user applications (800) calls the API (900), the size of the buffer for all user applications (800) is calculated. Through this, the user application (800) that calls the API (900) in the future can use the API (900) through the pre-allocated buffer. Hereinafter, the buffer allocated with reference to the number of user applications (800) is referred to as an application buffer (1000) (see FIG. 5). The application buffer (1000) may include at least one unit buffer (1010) corresponding to the number of user applications (800).
[0060] In the present invention, the number of at least one user application (800) may include the number of user applications (800) installed in the storage (200). In this case, the buffer size calculation unit (520) may calculate a buffer size corresponding to the number of user applications (800) installed in the storage (200). A user may install at least one user application (800) that he or she needs in the storage (200). The number of user applications (800) installed in the storage (200) may be transmitted to the buffer size calculation unit (520). The buffer size calculation unit (520) may calculate the size of the buffer to be allocated to the memory (300), i.e., the size of the application buffer (1000), by referring to the corresponding number.
[0061] Alternatively, in the present invention, the number of at least one user application (800) may include the number of user applications (800) loaded into the memory (300). In this case, the buffer size calculation unit (520) may calculate a buffer size corresponding to the number of user applications (800) loaded into the memory (300). The number of user applications (800) loaded into the memory (300) may be transmitted to the buffer size calculation unit (520). The buffer size calculation unit (520) may calculate the size of the buffer to be allocated to the memory (300) by referring to the corresponding number.
[0062] Alternatively, in the present invention, the number of at least one user application (800) may include the number of user applications (800) that can access the API (900). For example, access may be provided to user application 1 and user application 2 through API a, and access may be provided to user application 1, user application 2, and user application N through API b. In this case, the buffer size calculation unit (520) may calculate a buffer size corresponding to two when a call to API a occurs, and may calculate a buffer size corresponding to three when a call to API b occurs.
[0063] Fig. 5 is a drawing for explaining the operation of the memory management unit, Fig. 6 is a drawing for explaining that a user application operates using a buffer allocated to memory, and Fig. 7 is a drawing for explaining that a buffer is allocated for each API by the memory management unit.
[0064] Referring to FIG. 5, the memory management unit (600) can allocate an application buffer (1000) to the memory (300).
[0065] The memory management unit (600) can receive the size of the application buffer (1000) from the analysis unit (500) and allocate an application buffer (1000) corresponding to the size to the memory (300). FIG. 5 illustrates that an application buffer (1000) including N unit buffers (1010) is allocated to the memory (300) so that N user applications (800) can use API a. The unit buffer (1010) is a buffer required for one user application (800) to use API a, and a number of unit buffers (1010) corresponding to the number of user applications (800) can be allocated to the memory (300). After the allocation of the unit buffers (1010) is completed, the memory management unit (600) can transmit the address of the unit buffer (1010) to each user application (800). For example, the memory management unit (600) can send the address of unit buffer a1 to user application 1, the address of unit buffer a2 to user application 2, and the address of unit buffer aN to user application N.
[0066] Since N unit buffers (1010) corresponding to the number of user applications (800) are allocated in advance, each of the N user applications (800) can use the corresponding built-in application by calling API a at any time.
[0067] Since the allocation of the application buffer (1000) is performed in an integrated manner by the memory management unit (600), even when multiple applications call the same API (900) at the same time, the allocation of the application buffer (1000) for the corresponding API is not performed redundantly, thereby preventing memory errors such as memory invasion.
[0068] Referring to FIG. 6, a user application (800) can access a unit buffer (1010) allocated to it and use the API (900). The user application (800) can access the unit buffer (1010) allocated to it using an address received from the memory management unit (600).
[0069] FIG. 6 illustrates that user application 1 accesses unit buffer a1, user application 2 accesses unit buffer a2, and user application N accesses unit buffer aN. Each user application (800) can utilize API a using its corresponding unit buffer (1010). For example, if API a is a timestamp request command, a timestamp can be recorded in each unit buffer (1010). Each user application (800) can access its corresponding unit buffer (1010) to retrieve the timestamp.
[0070] Referring to FIG. 7, the memory management unit (600) can allocate application buffers (1000) for multiple APIs (900) to the memory (300).
[0071] For example, when a call command for API a is generated, the memory management unit (600) can allocate N unit buffers (1010) for use of API a, and when a call command for API b is generated, the memory management unit (600) can allocate N unit buffers (1010) for use of API b.
[0072] When the use of API (900) is terminated, the memory management unit (600) can release the allocation of the corresponding application buffer (1000). For example, when the use of API a by at least one user application (800) is completed, the memory management unit (600) can release all N unit buffers (1010) allocated for the use of API a.
[0073] Figure 8 is a diagram to explain that a buffer is allocated periodically.
[0074] Referring to FIG. 8, a buffer can be periodically allocated to memory (300).
[0075] The user application (800) may periodically call the API (900). For example, the user application (800) may periodically call the corresponding API (900) to retrieve a periodic timestamp.
[0076] The memory management unit (600) can allocate an application buffer (1000) to the memory (300) according to the usage cycle of the API (900). The call command of the user application (800) can include the usage cycle of the API (900). The memory management unit (600) allocates the application buffer (1000) to the memory (300) according to the usage cycle. Fig. 8 illustrates that the allocation and release of the application buffer (1000) are repeated according to the usage cycle of P.
[0077] The memory management unit (600) can deallocate the application buffer (1000) when the use of the API (900) is terminated. For example, the allocation time of the application buffer (1000) may be formed non-uniformly. Alternatively, the memory management unit (600) can deallocate the application buffer (1000) at a uniform time. For example, when the usage time of the API (900) is constant or received, the memory management unit (600) can deallocate the application buffer (1000) when a preset usage time has elapsed from the time the application buffer (1000) was allocated.
[0078] Meanwhile, when a call command requesting allocation of an application buffer (1000) in real time is received from a user application (800), the memory management unit (600) can allocate the application buffer (1000) in real time.
[0079] Figure 9 is a diagram showing a call command.
[0080] Referring to FIG. 9, the call command (1100) may include an identification information field (1110), a buffer size field (1120), a period field (1130), and a usage time field (1140).
[0081] The identification information field (1110) may specify identification information of the API (900). The call receiving unit (510) of the interpretation unit (500) can refer to the identification information specified in the identification information field (1110) to determine which API (900) the user application (800) is calling.
[0082] The buffer size field (1120) may specify the size of the buffer for use of the API (900). The user application (800) may calculate the size of the buffer for use of the API (900) and specify the size of the calculated buffer in the buffer size field (1120). The buffer size specified in the buffer size field (1120) may be the size of the unit buffer (1010). The buffer size calculation unit (520) may calculate the size of the application buffer (1000) by multiplying the size of the unit buffer (1010) by the number of user applications (800).
[0083] The period field (1130) may specify the usage period of the API (900). For example, the period field (1130) may include time information such as 1 second. The memory management unit (600) may allocate an application buffer (1000) to the memory (300) according to the period specified in the period field (1130). Meanwhile, if no time information is specified in the period field (1130), this may mean real-time buffer allocation. In this case, the memory management unit (600) may allocate an application buffer (1000) to the memory (300) immediately upon receiving a call command (1100).
[0084] The usage time field (1140) may specify the usage time of the API (900). For example, the usage time field (1140) may include time information such as 0.5 seconds. The memory management unit (600) may release the allocation of the application buffer (1000) by referring to the usage time specified in the usage time field (1140). For example, if 0.5 seconds is specified in the usage time field (1140), the application buffer (1000) may be released when 0.5 seconds have elapsed since the time at which the application buffer (1000) was allocated. On the other hand, if no time information is specified in the usage time field (1140), the memory management unit (600) may release the allocation of the application buffer (1000) when the use of the API (900) is terminated.
[0085] Although the embodiments of the present invention have been described above with reference to the accompanying drawings, those skilled in the art will appreciate that the present invention can be implemented in other specific forms without altering the technical concept or essential features thereof. Therefore, the embodiments described above should be understood to be illustrative in all respects and not restrictive.
Claims
1. An interpretation unit that receives an application programming interface (API) call command from at least one user application and calculates the size of a buffer for use of the API corresponding to the call command by referring to the number of the at least one user application; and A memory management device including a memory management unit that allocates a buffer corresponding to the above-described size to memory.
2. In paragraph 1, A memory management device including a size of a buffer for use of an API corresponding to the above call command, the size of which corresponds to the number of unit buffers allocated to enable one user application to use the API corresponding to the above call command, as many as the number of user applications.
3. In paragraph 1, A memory management device wherein the number of at least one user application includes the number of user applications installed in the storage.
4. In paragraph 1, A memory management device wherein the number of at least one user application includes the number of user applications loaded into memory.
5. In paragraph 1, A memory management device wherein the number of at least one user application includes the number of user applications that can access the API.
6. In paragraph 1, The above memory management unit is a memory management device that releases a buffer allocated to the memory for use of the API when use of the API by at least one user application is terminated.
7. In paragraph 1, The above call command includes the usage cycle of the above API, The above memory management unit is a memory management device that allocates a buffer corresponding to the calculated size to the memory according to the usage cycle.
8. In paragraph 7, The above memory management unit is a memory management device that repeats allocation and release of a buffer corresponding to the calculated size according to the above usage cycle.
9. In paragraph 8, The above memory management unit is a memory management device that releases the allocation of the buffer corresponding to the calculated size at a point in time when a preset usage time has elapsed from the point in time when the buffer corresponding to the calculated size was allocated.
10. A step of receiving a call command of an application programming interface (API) from at least one user application; A step of calculating the size of a buffer for use of an API corresponding to the call command by referring to the number of at least one user application; and A memory management method comprising a step of allocating a buffer corresponding to the above-described size to memory.
11. In paragraph 10, A memory management method in which the size of a buffer for use of an API corresponding to the above call command includes a size corresponding to the number of unit buffers allocated to enable one user application to use the API corresponding to the above call command, and the number of at least one user application is allocated.
12. In paragraph 10, A memory management method wherein the number of at least one user application includes the number of user applications installed in the storage.
13. In paragraph 10, A memory management method wherein the number of at least one user application includes the number of user applications loaded into memory.
14. In paragraph 10, A memory management method wherein the number of at least one user application includes the number of user applications that can access the API.
15. In paragraph 10, A memory management method in which a buffer allocated to the memory for use of the API is released when use of the API by at least one user application is terminated.
16. In paragraph 10, The above call command includes the usage cycle of the above API, A memory management method in which a buffer corresponding to the above-mentioned calculated size is allocated to the above-mentioned memory according to the above-mentioned usage cycle.
17. In paragraph 16, A memory management method in which allocation and release of a buffer corresponding to the calculated size are repeated according to the above-mentioned usage cycle.
18. In paragraph 17, A memory management method in which a buffer corresponding to the calculated size is released at a point in time when a preset usage time has elapsed from the point in time when the buffer corresponding to the calculated size is allocated.
Citation Information
Patent Citations
Transferring data between system and storage in a shared buffer
US20060126653A1
Buffer overflow exploit detection
US20180349597A1
Composite Batching to Manage Throughput for Online Commerce Applications
US20200278881A1
Methods and systems for multiple access to a single hardware data stream
US20220027212A1
Lock-less buffer management scheme for telecommunication network applications
US8504744B2