CN111597046A - Endoscope memory management method and endoscope - Google Patents

Endoscope memory management method and endoscope Download PDF

Info

Publication number
CN111597046A
CN111597046A CN202010412915.9A CN202010412915A CN111597046A CN 111597046 A CN111597046 A CN 111597046A CN 202010412915 A CN202010412915 A CN 202010412915A CN 111597046 A CN111597046 A CN 111597046A
Authority
CN
China
Prior art keywords
memory
mode
function
endoscope
window
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010412915.9A
Other languages
Chinese (zh)
Other versions
CN111597046B (en
Inventor
王维林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Autel Intelligent Technology Corp Ltd
Original Assignee
Autel Intelligent Technology Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Autel Intelligent Technology Corp Ltd filed Critical Autel Intelligent Technology Corp Ltd
Priority to CN202010412915.9A priority Critical patent/CN111597046B/en
Publication of CN111597046A publication Critical patent/CN111597046A/en
Priority to PCT/CN2021/088777 priority patent/WO2021227803A1/en
Application granted granted Critical
Publication of CN111597046B publication Critical patent/CN111597046B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Endoscopes (AREA)
  • Instruments For Viewing The Inside Of Hollow Bodies (AREA)

Abstract

The embodiment of the invention relates to the technical field of diagnostic equipment, and discloses an endoscope memory management method and an endoscope. The endoscope memory management method comprises the following steps: acquiring a mode switching instruction in a current functional mode, wherein the current functional mode is any one of a real-time video preview mode, a media management mode and a setting mode, and the real-time video preview mode, the media management mode and the setting mode are mutually decoupled so as to enable at least part of memory resources occupied by each functional mode to be unshared; switching the current functional mode to a target functional mode pointed by the mode switching instruction; and releasing the memory resources occupied by the current functional mode. Through the mode, the embodiment of the invention improves the utilization rate of the memory resource.

Description

Endoscope memory management method and endoscope
Technical Field
The invention relates to the technical field of diagnostic equipment, in particular to an endoscope memory management method and an endoscope.
Background
The endoscope is a detection instrument integrating traditional optics, ergonomics, precision machinery, modern electronics, mathematics and software, and is mainly used for checking the small aperture, the internal condition of a small gap, the abrasion and the looseness of mechanical gear parts and the quality of a nozzle tip oil pump in automobile manufacturing and maintenance, precision machining and manufacturing, petrochemical industry, military industry manufacturing and small equipment.
In the process of implementing the invention, the inventor finds that the prior art has the following problems: at present, the requirement for acquiring and processing images of endoscopes is higher, for example, the endoscope is provided with a plurality of image acquisition devices, and further, a high-definition image acquisition device is required to be configured. Moreover, the functions of video and image processing are multiple, the memory requirement is large, some functions require continuous memory, the shortage of memory resources is further caused, the failure of endoscope function realization is easily caused, and the user experience is reduced. Therefore, how to effectively utilize the memory resources in the endoscope becomes a problem to be solved by those skilled in the art.
Disclosure of Invention
The embodiment of the invention aims to provide an endoscope memory management method and an endoscope, which can improve the utilization rate of memory resources.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides an endoscope memory management method, including:
acquiring a mode switching instruction in a current functional mode, wherein the current functional mode is any one of a real-time video preview mode, a media management mode and a setting mode, and the real-time video preview mode, the media management mode and the setting mode are mutually decoupled so as to enable at least part of memory resources occupied by each functional mode to be unshared;
switching the current functional mode to a target functional mode pointed by the mode switching instruction;
and releasing the memory resources occupied by the current functional mode.
In some embodiments, the method further comprises:
when the user interaction function is executed in the current function mode, a function selection instruction is obtained;
searching a preset menu tree according to the function selection instruction so as to traverse a target window pointed by the function selection instruction step by step, wherein the preset menu tree comprises branch menus corresponding to each current function mode, and each branch menu comprises a parent window and a plurality of child windows under the parent window;
and displaying the target window.
In some embodiments, no more than three of the child windows under each of the parent windows.
In some embodiments, said displaying said target window comprises:
displaying the target window according to the corresponding relation between the user interaction function and the window;
the corresponding relation comprises that the video playback function corresponds to a double-buffering window, and other user interaction functions except the video playback function correspond to a dialog box window or a common window.
In some embodiments, the method further comprises:
except for the picture used by the target window and the picture used by the child window under the parent window in the parent window, other pictures are destroyed along with the destruction of the window.
In some embodiments, the method further comprises:
and only loading the character string corresponding to the language used by the user interaction function or the character string corresponding to the current function mode.
In some embodiments, the method further comprises:
and cutting the word stock of the endoscope according to the user interaction function.
In some embodiments, the method further comprises:
scanning a plurality of memory fragments of the endoscope;
and compressing the memory fragments at fixed time.
In some embodiments, the method further comprises:
scanning a plurality of memory fragments of the endoscope;
and compressing the memory fragments when the functional mode is switched.
In some embodiments, the method further comprises:
determining a memory allocation strategy according to the function executed in the current function mode;
and releasing the variable or the object used by the function when the function is executed according to the memory allocation strategy.
In a second aspect, embodiments of the present invention provide an endoscope comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the endoscope memory management method of any one of the above.
In a third aspect, embodiments of the present invention also provide a non-transitory computer-readable storage medium storing computer-executable instructions for enabling an endoscope to perform the endoscope memory management method according to any one of the above.
The embodiment of the invention has the beneficial effects that: in contrast to the situation in the prior art, in the endoscope and the memory management method for the endoscope provided by the embodiments of the present invention, functions supported by the endoscope are decoupled into the real-time video preview mode, the media management mode, and the setting mode, so that at least part of memory resources occupied by each functional mode are not shared, and when the current functional mode is switched, the memory resources occupied by the current functional mode are released. Therefore, the embodiment of the invention improves the utilization rate of the memory resources.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
Fig. 1 is an architecture diagram of an endoscope memory management system according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method of managing memory of an endoscope according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method of managing memory of an endoscope according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating an architecture of a preset menu tree according to an embodiment of the present invention;
FIG. 5 is a flowchart of a method of managing memory of an endoscope according to an embodiment of the present invention;
FIG. 6 is a flowchart of a method of managing memory of an endoscope according to an embodiment of the present invention;
FIG. 7 is a flowchart of a method of managing memory of an endoscope according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an endoscope memory management device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an endoscope memory management device according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an endoscope provided in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that although functional blocks are partitioned in a schematic diagram of an apparatus and a logical order is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the partitioning of blocks in the apparatus or the order in the flowchart. Furthermore, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
An embodiment of the present invention provides an architecture diagram of an endoscope memory management system, as shown in fig. 1, including an endoscope 10 and a device to be inspected 20. The endoscope 10 may be used to inspect the manufacturing and maintenance processes of the device 20 to be inspected. The device to be inspected 20 includes automobiles, home electric appliances, various types of pipes, medical equipment, aviation equipment, mechanical equipment, and the like. The embodiment of the present invention will be described by taking the endoscope 10 as an automotive endoscope.
The car endoscope comprises a plurality of high-definition cameras, an illumination light source, a display screen, keys, a loudspeaker, a microphone, a battery, an indicator light, a charger and the like (not shown in the figure), which are all connected to the processor 101 shown in fig. 10. The plurality of high-definition cameras and the MCU of the automobile endoscope communicate through the USB to transmit compressed Mjpeg format pictures, the MCU runs a Linux system, receives detection data from the plurality of high-definition cameras through UVC (USB Video Class) and decompresses the detection data into image data in YUV format for Video preview, recording or image storage.
The automobile endoscope comprises the following aspects in the maintenance process of an automobile: (1) inspecting an inner cavity: inspecting the surface for cracks, peeling, drawing lines, scratches, pits, bulges, spots, corrosion and other defects; (2) and (4) checking the state: when some products (such as turbines, engines and the like) work, the endoscope detection is carried out according to the items specified by technical requirements; (3) assembly inspection: when a certain procedure or all procedures of assembly are finished, checking whether the assembly positions of all parts meet the requirements of a sample drawing or a technology, whether assembly defects exist, and the like; (4) and (3) redundant material inspection: checking the remainders, such as residual inner scraps, foreign matters and the like in the inner cavity of the product; (5) inspecting weld surface defects: and checking the welding problems of surface cracks, incomplete penetration, missing welding and the like of the welding seam.
Taking the state inspection of an automobile endoscope as an example, when the automobile endoscope is used for cleaning and inspecting an engine, before the engine is cleaned, the carbon deposition condition and the like in the engine are observed by the automobile endoscope, and a first image is acquired; after the engine is cleaned, observing the carbon deposition condition and the like in the engine by using the automobile endoscope again, and acquiring a second image; the first image and the second image are compared, and the engine cleaning effect can be visually observed. When the automobile endoscope is used for checking the quality of the engine, the inner cavity of the engine is checked by adopting the automobile endoscope, and a third image is obtained; judging whether casting defects or burrs exist in the inner cavity of the engine or not by observing the third image; if casting defects or burrs exist in the inner cavity of the engine, the engine is sent into a maintenance area; and if the inner cavity of the engine has no casting defects or burrs, determining that the quality of the engine is qualified.
In some application scenarios, the endoscope memory management system further includes a terminal device 30. The terminal device 30 is connected with the automobile endoscope in a communication mode, and the terminal device 30 is used for storing or processing detection data sent by the automobile endoscope. The terminal device 30 may include a portable mobile electronic device such as a smart phone, a computer, a palm computer, a tablet computer, a smart watch, etc., a large computing device such as a server, etc., and other electronic devices with data interaction functions.
As shown in fig. 2, an endoscope memory management method S200 according to an embodiment of the present invention is applicable to the endoscope shown in fig. 1, where the endoscope memory management method S200 includes:
s21, acquiring a mode switching instruction in a current functional mode, wherein the current functional mode is any one of a real-time video preview mode, a media management mode and a setting mode, and the real-time video preview mode, the media management mode and the setting mode are mutually decoupled so as to enable at least part of memory resources occupied by each functional mode to be unshared.
In the embodiment of the application, the endoscope can divide the functions which can be realized into a real-time video preview function, a media management function and a setting function according to the access or occupation requirements of the memory resources, so that the requirements for the memory resources among the functions are mutually different, and the requirements for the memory resources in the functions have common characteristics. The specific requirements of each function for memory resources can be seen in the following description.
Each function corresponds to a function mode, which is a real-time video preview mode, a media management mode and a setting mode. The endoscope can be switched among the three modes to respectively realize the functions corresponding to the functional modes. Wherein, the switching of the function mode can be triggered by the operation of a user; or triggered by the endoscope according to specific triggering conditions, and the embodiment of the present application is not limited to the specific triggering conditions.
The realization of each function can be realized by a program module stored in the memory of the endoscope, namely, the MCU of the endoscope is realized by operating an executable program in the memory; of course, also program modules may be implemented in combination with corresponding hardware.
Each function may include several sub-functions to refine the implementation of each function. For specific sub-functions included in each function, please refer to the description below. The behavior of the endoscope to implement each function or a sub-function included in each function is understood to be a service in each functional mode. The mutual decoupling of the functional modes means that services in the functional modes are mutually decoupled. Here, the service decoupling may be understood as that the service relevance between the functions is low or no relevance, and the access requirement of the service to the memory resource is independent or at least part of the access requirement is independent when the function is realized. The independent access requirement of the service on the memory resource when the function is realized means that the service in a certain function mode accesses the memory resource without being associated with the service in other function modes, and the service in the function mode has no access requirement on the memory resource in other function modes. When the endoscope runs in a certain function mode, the endoscope can allocate memory resources for the service in the function mode, and when the endoscope is switched to another function mode, the endoscope releases the memory resources in the previous function mode and reallocates the memory resources for the service in the other function mode. It is also understood that at least a portion of the memory resources occupied by each functional mode are not shared.
The memory resource occupied by each functional mode is the access or other operations of the memory resource when the service is realized. After the function mode is determined, the endoscope allocates corresponding memory resources for the realization of the function according to the demand characteristics of the function corresponding to the function mode on the memory resources, and the allocated memory resources can be understood as the memory resources occupied by the function mode, so that the memory resources under each function mode are not shared. Usually, most of the memory resources in each functional mode are independent and not shared with the memory resources in other functional modes; the memory resource of each function mode partially shares the memory resource occupied by the overlapping part so as to respectively realize the function corresponding to each function mode. If the endoscope determines the function mode and allocates corresponding memory resources for the implementation of the function, if the implementation of the function is found to depend on the memory resources occupied by other function modes, the memory resources occupied by other function modes need to be accessed to call the related memory resources, so that the function or the sub-functions included in the function are implemented in the function mode.
The real-time video preview function includes image transmission, image decoding, image scaling, format conversion, image display and the like. When the endoscope is used for taking or recording pictures, the real-time video preview function further comprises image or video compression, file storage and the like. For the live video preview function, all image processing related operations require continuous memory. The continuous physical memory of the real-time video preview function is mainly a large continuous memory, and the continuous memory has a plurality of continuous memory blocks and has constant demand. The demand of the discontinuous physical memory of the real-time video preview function is less, but constant.
The media management function needs to open up a window for UI (User Interface) interaction, which includes picture display and video playback. Wherein the picture presentation is mainly based on a form of thumbnail, and the thumbnail operation involves image decoding and image scaling. Video playback operations require video decoding and image output. For media management functions, operations related to images and video require continuous memory. The continuous physical memory of the media management function is mainly a small continuous memory, but the continuous memory has a plurality of continuous memory blocks and the requirement of the continuous physical memory is constant. The demand of the discontinuous physical memory of the media management function is high, and the demand quantity is related to the quantity of the files.
The setting function is used for setting system applications and configuration parameters, for example, interfaces which can be used for setting a real-time video preview function and a media management function, and taking image zooming as an example, the setting function can be used for setting triggering operation, zooming operation, magnification or reduction factor, display mode, hovering mode, ending operation and the like of image zooming. For the continuous physical memory for setting the function, a large block of continuous physical memory is used for establishing the window, a small block of continuous physical memory is used for the UI picture, and the continuous physical memory is related to the number of the windows. The non-continuous physical memory for setting the function is more in demand, and the demand quantity is related to the number of windows.
And S22, switching the current functional mode to the target functional mode pointed by the mode switching instruction.
And S23, releasing the memory resource occupied by the current functional mode.
The endoscope is generally developed based on an embedded system, and at least part of memory resources occupied by each functional mode are not shared, so that when the embedded system allocates memory, the memory can be considered only according to the memory requirement of the current functional mode. When the current function mode is switched to the target function mode pointed by the mode switching instruction, the memory resources occupied by the current function mode are released, and the memory space is vacated for the target function mode, so that the situations of insufficient memory resources, failure in memory resource application, incapability of normally operating service functions and the like are avoided.
For example, in real-time video preview mode, the endoscope system occupies a large amount of contiguous physical memory for video capture, real-time image processing and display. When the real-time video preview mode is switched to the media management mode, the memory access requirement is mainly that the content of the UI and the media file is displayed, the real-time video does not need to be displayed to a user, the real-time video acquisition unit and the image processing unit can be closed, and a large amount of continuous physical memory is released. When the media management mode is switched to the real-time video preview mode again, the memory resources occupied by the media management mode are released, the memory resources are reallocated for the real-time video preview mode, and a plurality of high-definition cameras of the endoscope are opened.
As shown in fig. 3, in some embodiments, the method further includes an endoscope memory management method S300, including:
and S31, acquiring a function selection instruction when the user interaction function is executed in the current function mode.
And S32, searching a preset menu tree according to the function selection instruction so as to traverse the target window pointed by the function selection instruction step by step, wherein the preset menu tree comprises branch menus corresponding to each current function mode, and each branch menu comprises a parent window and a plurality of child windows under the parent window.
Wherein the child windows under each parent window are no more than three.
Fig. 4 is a schematic diagram illustrating an architecture of a preset menu tree according to an embodiment of the present invention. The preset menu tree is designed according to the interrelation between the service functions and the operation flow. The invention takes a 3-layer preset menu tree as an example, and comprises a menu node L11 of a first layer, menu nodes L21, L22 and L23 of a second layer, and menu nodes L31, L32, L33, L34, L35 and L36 of a third layer.
Each menu node corresponds to one window, the window corresponding to the menu node L11 is a parent window, and the windows corresponding to the menu nodes L21, L22, L23, L31, L32, L33, L34, L35 and L36 are all child windows under the parent window corresponding to the menu node L11. Further, the window corresponding to the menu node L21 is a parent window of the windows corresponding to the menu nodes L31 and L32. The window corresponding to the menu node L22 is a parent window of the window corresponding to the menu node L33. The window corresponding to the menu node L23 is a parent window of the windows corresponding to the menu nodes L31, L32, and L33.
In the present embodiment, the menu nodes L21, L22, and L23 are windows corresponding to the live video preview mode, the media management mode, and the setting mode, respectively. The branch menu corresponding to the live video preview mode includes a menu node L11, a menu node L21, a menu node L31, and a menu node L32. The branch menu corresponding to the media management mode includes a menu node L11, a menu node L22, and a menu node L33. The branch menu corresponding to the setting mode includes a menu node L11, a menu node L23, a menu node L34, a menu node L35, and a menu node L36.
It can be understood that the deeper the preset menu tree is, the more the nesting levels between windows are, and the nesting between windows will occupy considerable memory resources, which is likely to cause insufficient memory resources. Referring to fig. 4 again, the probability of data sharing between adjacent function levels, such as the menu node L21 and the menu node L31, is high, and the more the function levels differ, such as the menu node L11 and the menu node L31, the lower the probability of data sharing. Therefore, by controlling the preset menu tree level, the application requirement of the endoscope is met, and the problem that more memories are occupied due to nesting among windows is solved.
And S33, displaying the target window.
The functions of the user interaction function with high demand on the memory resources comprise a window, character strings, a word stock and UI pictures. In this implementation, displaying the target window includes: and displaying the target window according to the corresponding relation between the user interaction function and the window. The corresponding relation comprises that the video playback function corresponds to a double-buffering window, and other user interaction functions except the video playback function correspond to a dialog box window or a common window.
The windows comprise a dialog box window, a common window and a double-buffer window, from the dialog box window, the common window to the double-buffer window, the functions and the interaction effect supported by the windows are gradually enhanced, and the required memory resources are gradually increased. Therefore, under the condition of meeting the requirement of the service function, the dialog box window is preferably selected, and the use of a common window or a double-buffer window is avoided as much as possible, so that the use of memory resources is reduced. Video playback and other functions can be played only by double buffer windows, and at the moment, the double buffer windows are selected for displaying.
In some embodiments, the method further comprises: except for the picture used by the target window and the picture used by the child window under the parent window in the parent window, other pictures are destroyed along with the destruction of the window.
In the aspect of UI picture loading, the picture caching is allowed only in the following two cases: (1) pictures used by the current window (i.e., the target window); (2) and the picture in the parent window is used by the child window at the same time. And other UI pictures are destroyed along with the destruction of the window without caching, and when the window is redrawn next time, the UI pictures are reloaded.
In some embodiments, the method further comprises: and only loading the character string corresponding to the language used by the user interaction function or the character string corresponding to the current function mode.
The character string as data resource needs to occupy certain memory, especially when endoscope supports multiple languages, the memory space occupied by character string increases linearly. In order to save memory resources, the character strings are dynamically loaded according to a character string loading strategy. The character string loading strategy comprises the following steps: (1) only loading character strings related to the current language; (2) only the character string under the operation of the current function is loaded. For example, if the menu nodes L21, L22, and L23 are windows corresponding to the live video preview mode, the media management mode, and the setting mode, respectively, the strings in the live video preview mode, the media management mode, and the setting mode are relatively independent, when the menu node L21 and its sub-functions are operated, only the string corresponding to the function mode corresponding to the menu node L21 is loaded, and when the menu node L21 exits from the function, the corresponding string is released.
In some embodiments, the method further comprises: and cutting the word stock of the endoscope according to the user interaction function.
The vector font library of full characters is at least ten megabytes in size, full loading is more stressful for the memory of the endoscope, and most characters cannot be referenced. Because the endoscope does not have the condition that the user inputs characters and the characters required to be displayed are determined during design, only the characters required by the item (namely the user interaction function) are reserved by cutting the word stock, and more than ten times of memory space can be saved.
With the increase of the running time of the endoscope system, memory space is easy to generate memory fragments, even if the idle memory of the system is large, the memory shortage exists for some functions requiring continuous physical memory, and the problem of memory allocation failure is easy to cause. In view of the above problems, memory compression is adopted for memory recovery, and a large amount of memory fragments can be merged into a large usable memory block.
As shown in fig. 5, as an embodiment of the present invention, the method further includes an endoscope memory management method S500, including:
s51, scanning a plurality of memory fragments of the endoscope.
And S52, compressing the memory fragments at regular time.
The small partitions in main memory that are generated by the process of memory allocation and that cannot be used by user jobs are called memory fragments. Memory fragmentation occurs in two ways, internal fragmentation and external fragmentation. The process of internal debris generation is: because all memory allocations must start at an address that is divisible by 4, 8, or 16 (depending on the processor architecture) or because of the limitations of the paging mechanism of the MMU, it is determined that the memory allocation algorithm can only allocate memory blocks of a predetermined size to a guest. Assuming that when a 43-byte block of memory is requested, there is no suitable size of memory, it is possible to obtain a bit larger bytes such as 44 bytes, 48 bytes, etc., so the extra space resulting from rounding off the required size is called an internal fragment. The generation process of the external debris is as follows: frequent allocation and reclamation of physical pages can result in a large number of contiguous small blocks of pages being interspersed among allocated pages, creating external fragmentation. Assume that there is a block with a total of 100 units of contiguous free memory space, ranging from 0 to 99. If a memory block is applied for, for example, 10 units, the applied memory block is in an interval of 0 to 9. Continuing to apply for a block of memory, for example, 5 units, the memory block obtained by the second block should be within an interval of 10-14. If the first block of memory block is released, then a block of memory block larger than 10 units, for example 20 units, is applied. Since the memory block just released cannot satisfy the new request, only 20 units of memory blocks can be allocated starting from 15. The state of the whole memory space is 0-9 idle, 10-14 occupied, 15-34 occupied and 25-99 idle. Wherein 0-9 is a memory fragment. If 10-14 are occupied all the time and the space applied later is larger than 10 units, 0-9 are never used and become external fragments.
Aiming at the characteristics that the number of the memory fragments is large and the memory fragments cannot be utilized, the step of regularly compressing the memory fragments comprises the following steps: collecting the plurality of memory fragments; and merging the plurality of memory fragments to obtain the available memory. The available memory capacity is much larger than the capacity of the memory fragments.
The endoscope system starts a timing task, assuming that a clock period is 1 second, performs memory compression once when the accumulated count reaches a compression time (e.g., 5 minutes), and so on. As shown in fig. 6, as an embodiment of the present invention, the method further includes an endoscope memory management method S600, including:
s61, scanning a plurality of memory fragments of the endoscope.
S62, compressing the memory fragments when the functional mode is switched.
The demand for contiguous physical memory typically increases suddenly during a functional mode switch. By means of memory compression, the memory recovery response rate of the continuous physical memory can be improved, so that the target function mode has enough continuous physical memory to be distributed, and stable operation of the service function in the target function mode is not influenced.
As shown in fig. 7, in some embodiments, the method further includes an endoscope memory management method S700, including:
and S71, determining a memory allocation strategy according to the function executed in the current function mode.
And S72, releasing the variables or objects used by the function when the function is executed according to the memory allocation strategy.
The memory allocation policy includes static memory allocation and dynamic memory allocation. The static memory is automatically allocated by the system and automatically released by the system. Static memory is allocated in a stack, which is a storage structure. If the main function calls another function, the called function is pushed into a stack. Executing the called function is to make all memory spaces allocated to the function by the system pop one by one, the popping is completed when the called function is executed, and the memory spaces allocated to the static variables by the system are released after the execution in the program is completed. Dynamic memory is manually allocated by a programmer, manually released, and function terminations are not automatically released by the system. Dynamic memory is allocated in a heap, the heap is not a storage structure, and the heap is a sorting mode of allocated memory, wherein the sorting mode comprises bubble sorting, insertion sorting, selection sorting, quick sorting and the like. Because the dynamic memory is allocated in the heap, the function is not released after the end of its run.
The differences and characteristics of static memory allocation and dynamic memory allocation are as follows: (1) static memory allocation is completed during compiling, CPU resources are not occupied, dynamic memory allocation is completed during running, and allocation and release need to occupy CPU resources; (2) static memory allocation is allocated on the stack, and dynamic memory is allocated on the heap; (3) dynamic memory allocation requires support of pointers or reference data types, while static memory allocation does not; (4) static memory allocation is allocated according to a plan, the size of a memory block is determined before compiling, and allocation is performed according to needs when dynamic memory allocation is operated; (5) statically allocating the memory refers to that the control right of the memory is given to a compiler, and the dynamic memory refers to that of the memory to a programmer; (6) the running efficiency of statically allocating the memory is higher than that of dynamically allocating the memory because the allocation and release of the dynamic memory need extra overhead; (7) the dynamic memory management level is heavily dependent on the level of a programmer, and improper processing easily causes memory leakage.
Taking the process-oriented language software design as an example, the global variable and the static variable occupy certain memory resources and are not released in the whole application operation life cycle. The global variable is used for allocating memory when an object is created, and the process of creating the object comprises the following steps: allocating space; recursively creating a parent object; initializing member variables; calling a structure method creates an object. The static variable is used for allocating space when the class is loaded, the static variable has no relation with the object, and the loading process comprises the following steps: loading a parent class, and if the parent class is already loaded, not loading; initializing a static attribute; static code blocks are initialized in sequence, the initialization presupposes that space is allocated, and static variables are not initialized when objects are created later, so that the shared information is generally saved by the static variables.
It should be noted that most variables are only associated with some functions, and do not need to be retained in a memory, especially a large data block, for a long time. Thus, dynamic memory allocation is used for large blocks of data, released immediately after the associated functional logic runs out. For part of applications, variables are defined more, and the relevance between the variables is larger, but each variable occupies a small number of memory units, and if dynamic memory allocation is adopted, the execution efficiency is not high. Therefore, the variables are organized by adopting the objects, the objects are dynamically generated, and the objects are released after the objects are used, so that the memory space is saved, and the operation efficiency of the endoscope is improved.
According to the endoscope memory management method provided by the embodiment of the invention, functions supported by an endoscope are decoupled into a real-time video preview mode, a media management mode and a setting mode, so that at least part of memory resources occupied by each function mode are not shared, and when the current function mode is switched, the memory resources occupied by the current function mode are released. Therefore, the embodiment of the invention improves the utilization rate of the memory resources.
Correspondingly, the embodiment of the invention provides an endoscope memory management device. As shown in fig. 8, the endoscope memory management device 800 includes a first acquisition module 801, a switching module 802, and a first release module 803.
A first obtaining module 801, configured to obtain a mode switching instruction in a current functional mode, where the current functional mode is any one of a real-time video preview mode, a media management mode, and a setting mode, and the real-time video preview mode, the media management mode, and the setting mode are decoupled from each other, so that at least a portion of memory resources occupied by the functional modes are not shared.
A switching module 802, configured to switch the current functional mode to a target functional mode pointed by the mode switching instruction.
A first releasing module 803, configured to release the memory resource occupied by the current functional mode.
In some embodiments, embodiments of the present invention provide another endoscopic memory management device. As shown in fig. 9, the endoscope memory management device 900 according to the embodiment of the present invention includes a second acquisition module 901, a search module 902, and a display module 903.
A second obtaining module 901, configured to obtain a function selection instruction when the user interaction function is executed in the current function mode.
A searching module 902, configured to search a preset menu tree according to the function selection instruction, so as to traverse a target window pointed by the function selection instruction step by step, where the preset menu tree includes branch menus corresponding to each current function mode, and each branch menu includes a parent window and a plurality of child windows under the parent window.
Wherein the child windows under each parent window are no more than three.
And a display module 903, configured to display the target window.
The display module 903 is specifically configured to: and displaying the target window according to the corresponding relation between the user interaction function and the window. The corresponding relation comprises that the video playback function corresponds to a double-buffering window, and other user interaction functions except the video playback function correspond to a dialog box window or a common window.
As an embodiment of the present invention, the endoscope memory management device 900 further includes:
a destroying module 904, configured to destroy, along with the destruction of the window, other pictures except the picture used by the target window and the picture used by the child window in the parent window at the same time.
As an embodiment of the present invention, the endoscope memory management device 900 further includes:
a loading module 905, configured to load only a character string corresponding to a language used by the user interaction function or a character string corresponding to the current functional mode.
As an embodiment of the present invention, the endoscope memory management device 900 further includes:
and the cutting module 906 is used for cutting the word stock of the endoscope according to the user interaction function.
As an embodiment of the present invention, the endoscope memory management device 900 further includes:
a scanning module 907 for scanning a plurality of memory fragments of the endoscope.
A first compressing module 908, configured to compress the memory fragments periodically.
As an embodiment of the present invention, the endoscope memory management device 900 further includes:
a scanning module 907 for scanning a plurality of memory fragments of the endoscope.
A second compressing module 909, configured to compress the plurality of memory fragments when the functional mode is switched.
As an embodiment of the present invention, the endoscope memory management device 900 further includes:
a determining module 910, configured to determine a memory allocation policy according to a function executed in the current functional mode.
A second releasing module 911, configured to release, according to the memory allocation policy, a variable or an object used by the function when the function is executed completely.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
Fig. 10 is a schematic structural diagram of an endoscope according to an embodiment of the present invention. As shown in fig. 10, a hardware configuration of an endoscope 10 capable of executing the endoscope memory management method in fig. 2 to 3 and 5 to 7 is shown.
The endoscope 10 includes at least one processor 101 and a memory 102 communicatively coupled to the at least one processor 101, with one processor 101 being exemplified in fig. 10. The memory 102 stores instructions executable by the at least one processor 101 to enable the at least one processor 101 to perform an endoscope memory management method according to any method embodiment of the present invention.
The processor 101 and the memory 102 may be connected by a bus or other means, and fig. 10 illustrates the connection by a bus as an example.
The memory 102 is a non-volatile computer-readable storage medium, and can be used for storing non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the endoscope memory management method in the embodiment of the present invention, for example, the modules shown in fig. 8 and 9. The processor 101 executes various functional applications and data processing of the endoscope 10, i.e., implements the endoscope memory management method described in any method embodiment of the present invention, by executing non-volatile software programs, instructions, and modules stored in the memory 102.
The memory 102 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the endoscope memory management device, and the like. Further, the memory 102 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 102 optionally includes memory located remotely from processor 101, which may be connected over a network to a device that controls endoscope memory management. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the storage 102, and when executed by the one or more processors 101, perform the endoscope memory management method in any of the above method embodiments, for example, perform the steps shown in fig. 2 to 3 and fig. 5 to 7 described above, and implement the functions of the modules shown in fig. 8 to 9.
In the embodiment of the present application, the memory 102 includes a random access memory 1021, a Flash memory 1022, and an SD memory card 1023, and the random access memory 1021, the Flash memory 1022, and the SD memory card 1023 are memories of the endoscope 10. The ram 1021, also called main memory, is an internal memory for directly exchanging data with the processor 101, and temporarily stores programs, data, and intermediate results. Flash memory 1022 is a non-volatile memory used for long-term storage of data. The SD memory card 1023 is removably mounted in the endoscope for high-speed data storage.
The processor 101 can read data and instructions from the ram 1021, the Flash memory 1022, and the SD memory card 1023 through a bus or the like. Assuming that a program corresponding to each function or a plurality of sub-functions included in the function includes code data, read-only data, read-write data, and initialization data, when the program runs, the Flash memory 1022 allocates a memory space for storing the code data and the read-only data, and the random access memory 1021 allocates a memory space for storing the read-write data and the initialization data, that is, the code data and the read-only data occupy memory resources of the Flash memory 1022, and the read-write data and the initialization data occupy memory resources of the random access memory 1021.
For example, the processor 101 includes a CPU and a controller (not shown), when a function is executed in the current function mode, the CPU receives an operation instruction, the corresponding program instruction in the hard disk is directly loaded into at least one of the memory storages of the ram 1021, the Flash memory 1022 and the SD memory card 1023, then an addressing operation is performed on at least one of the memory storages of the ram 1021, the Flash memory 1022 and the SD memory card 1023, then the instruction loaded into at least one of the memory storages of the ram 1021, the Flash memory 1022 and the SD memory card 1023 is translated, and finally an operation signal is sent to the controller, so as to implement the operation of the program or the processing of data.
Embodiments of the present invention also provide a non-transitory computer-readable storage medium storing computer-executable instructions for enabling an endoscope to perform the endoscope memory management method according to any method embodiment of the present invention, for example, execute the steps shown in fig. 2 to 3 and fig. 5 to 7 described above to implement the functions of the modules shown in fig. 8 to 9.
Embodiments of the present invention further provide a computer program product including a computer program stored on a non-volatile computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the endoscope memory management method in any of the above method embodiments, for example, executes the steps shown in fig. 2 to 3 and fig. 5 to 7 described above, and implements the functions of the modules shown in fig. 8 to 9.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Through the above description of the embodiments, those skilled in the art will clearly understand that the embodiments may be implemented by software plus a general hardware platform, and may also be implemented by hardware. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (11)

1. An endoscope memory management method, comprising:
acquiring a mode switching instruction in a current functional mode, wherein the current functional mode is any one of a real-time video preview mode, a media management mode and a setting mode, and the real-time video preview mode, the media management mode and the setting mode are mutually decoupled so as to enable at least part of memory resources occupied by each functional mode to be unshared;
switching the current functional mode to a target functional mode pointed by the mode switching instruction;
and releasing the memory resources occupied by the current functional mode.
2. The method of claim 1, further comprising:
when the user interaction function is executed in the current function mode, a function selection instruction is obtained;
searching a preset menu tree according to the function selection instruction so as to traverse a target window pointed by the function selection instruction step by step, wherein the preset menu tree comprises branch menus corresponding to each current function mode, and each branch menu comprises a parent window and a plurality of child windows under the parent window;
and displaying the target window.
3. The method of claim 2, wherein no more than three of the child windows under each of the parent windows are present.
4. The method of claim 2, wherein the displaying the target window comprises:
displaying the target window according to the corresponding relation between the user interaction function and the window;
the corresponding relation comprises that the video playback function corresponds to a double-buffering window, and other user interaction functions except the video playback function correspond to a dialog box window or a common window.
5. The method according to any one of claims 2-4, further comprising:
except for the picture used by the target window and the picture used by the child window under the parent window in the parent window, other pictures are destroyed along with the destruction of the window.
6. The method according to any one of claims 2-4, further comprising:
and only loading the character string corresponding to the language used by the user interaction function or the character string corresponding to the current function mode.
7. The method according to any one of claims 2-4, further comprising:
and cutting the word stock of the endoscope according to the user interaction function.
8. The method of claim 1, further comprising:
scanning a plurality of memory fragments of the endoscope;
and compressing the memory fragments at fixed time.
9. The method of claim 1, further comprising:
scanning a plurality of memory fragments of the endoscope;
and compressing the memory fragments when the functional mode is switched.
10. The method of claim 1, further comprising:
determining a memory allocation strategy according to the function executed in the current function mode;
and releasing the variable or the object used by the function when the function is executed according to the memory allocation strategy.
11. An endoscope, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the endoscope memory management method of any one of claims 1-10.
CN202010412915.9A 2020-05-15 2020-05-15 Endoscope memory management method and endoscope Active CN111597046B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010412915.9A CN111597046B (en) 2020-05-15 2020-05-15 Endoscope memory management method and endoscope
PCT/CN2021/088777 WO2021227803A1 (en) 2020-05-15 2021-04-21 Endoscope memory management method and endoscope

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010412915.9A CN111597046B (en) 2020-05-15 2020-05-15 Endoscope memory management method and endoscope

Publications (2)

Publication Number Publication Date
CN111597046A true CN111597046A (en) 2020-08-28
CN111597046B CN111597046B (en) 2023-12-22

Family

ID=72191070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010412915.9A Active CN111597046B (en) 2020-05-15 2020-05-15 Endoscope memory management method and endoscope

Country Status (2)

Country Link
CN (1) CN111597046B (en)
WO (1) WO2021227803A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112338919A (en) * 2020-10-30 2021-02-09 珠海市一微半导体有限公司 Robot operation control method, robot and chip
WO2021227803A1 (en) * 2020-05-15 2021-11-18 深圳市道通科技股份有限公司 Endoscope memory management method and endoscope

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116028383B (en) * 2022-08-22 2023-10-20 荣耀终端有限公司 Cache management method and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103188453A (en) * 2011-12-31 2013-07-03 联想(北京)有限公司 Control method, device and electronic device of television playing
CN103716535A (en) * 2013-12-12 2014-04-09 乐视致新电子科技(天津)有限公司 Method for switching photographing mode, and electronic device
CN104735359A (en) * 2015-04-09 2015-06-24 广东欧珀移动通信有限公司 Mobile terminal camera running method and device
CN108833960A (en) * 2018-06-14 2018-11-16 青岛海信传媒网络技术有限公司 A kind of method and device of audiovisual applications switching

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4643481B2 (en) * 2006-03-23 2011-03-02 オリンパスメディカルシステムズ株式会社 Image processing device
CN102521053B (en) * 2011-12-13 2014-04-16 深圳市安云信息科技有限公司 Memory system and on-line switching method of FC (Fiber Channel) port working mode
JP5810248B2 (en) * 2013-10-02 2015-11-11 オリンパス株式会社 Endoscope system
WO2018031558A1 (en) * 2016-08-12 2018-02-15 Boston Scientific Scimed, Inc. Distributed interactive medical visualization system with primary/secondary interaction features
CN111597046B (en) * 2020-05-15 2023-12-22 深圳市道通科技股份有限公司 Endoscope memory management method and endoscope

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103188453A (en) * 2011-12-31 2013-07-03 联想(北京)有限公司 Control method, device and electronic device of television playing
CN103716535A (en) * 2013-12-12 2014-04-09 乐视致新电子科技(天津)有限公司 Method for switching photographing mode, and electronic device
CN104735359A (en) * 2015-04-09 2015-06-24 广东欧珀移动通信有限公司 Mobile terminal camera running method and device
CN108833960A (en) * 2018-06-14 2018-11-16 青岛海信传媒网络技术有限公司 A kind of method and device of audiovisual applications switching

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021227803A1 (en) * 2020-05-15 2021-11-18 深圳市道通科技股份有限公司 Endoscope memory management method and endoscope
CN112338919A (en) * 2020-10-30 2021-02-09 珠海市一微半导体有限公司 Robot operation control method, robot and chip
CN112338919B (en) * 2020-10-30 2022-03-04 珠海一微半导体股份有限公司 Robot operation control method, robot and chip

Also Published As

Publication number Publication date
CN111597046B (en) 2023-12-22
WO2021227803A1 (en) 2021-11-18

Similar Documents

Publication Publication Date Title
WO2021227803A1 (en) Endoscope memory management method and endoscope
US11531625B2 (en) Memory management method and apparatus
CN107391653B (en) Distributed NewSQL database system and picture data storage method
US8214577B2 (en) Method of memory management for server-side scripting language runtime system
US7707232B2 (en) Implementation for collecting unmanaged memory
US8095772B2 (en) Large memory pages for shared libraries
CN108132890B (en) Garbage recycling method, device and equipment for memory chip and storage medium
US9400754B2 (en) Asynchronous swap mechanism and page eviction from memory
CN108052643B (en) Data storage method and device based on LSM Tree structure and storage engine
JP2009032252A (en) Memory allocation for crash dump
US6615364B1 (en) Computer system and methods for acquiring dump information and system recovery
CN106557427B (en) Memory management method and device for shared memory database
KR101087425B1 (en) System and method for resizing a database
US9471366B2 (en) Virtual machine disk image backup using block allocation area
CN110737680A (en) Cache data management method and device, storage medium and electronic equipment
CN114595164B (en) Method and apparatus for managing TLB cache in virtualized platform
CN115712500A (en) Memory release method, memory recovery method, memory release device, memory recovery device, computer equipment and storage medium
CN115407943A (en) Memory dump file generation method, device and equipment and readable storage medium
CN109683983B (en) Method and equipment for generating and loading mirror image file
US7644114B2 (en) System and method for managing memory
CN115495020A (en) File processing method and device, electronic equipment and readable storage medium
CN111984197B (en) Computer cache allocation method
RU2666334C2 (en) Method of data processing
CN109634877B (en) Method, device, equipment and storage medium for realizing stream operation
US20190018795A1 (en) Method and apparatus for an efficient tlb lookup

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant