CN105700968A - Method and device for memory leakage diagnosis processing in embedded system - Google Patents

Method and device for memory leakage diagnosis processing in embedded system Download PDF

Info

Publication number
CN105700968A
CN105700968A CN201610015205.6A CN201610015205A CN105700968A CN 105700968 A CN105700968 A CN 105700968A CN 201610015205 A CN201610015205 A CN 201610015205A CN 105700968 A CN105700968 A CN 105700968A
Authority
CN
China
Prior art keywords
memory
sub
application
internal memory
internal
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.)
Pending
Application number
CN201610015205.6A
Other languages
Chinese (zh)
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.)
Xiamen Yaxon Networks Co Ltd
Original Assignee
Xiamen Yaxon Networks Co 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 Xiamen Yaxon Networks Co Ltd filed Critical Xiamen Yaxon Networks Co Ltd
Priority to CN201610015205.6A priority Critical patent/CN105700968A/en
Publication of CN105700968A publication Critical patent/CN105700968A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0736Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in functional embedded systems, i.e. in a data processing system designed as a combination of hardware and software dedicated to performing a certain function
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention belongs to the field of computer technology application, and particularly relates to a method and a device for memory leakage diagnosis processing in an embedded system. The method comprises the following steps: S1: dividing a memory into memory blocks of different sizes, wherein each memory block is equally divided into a plurality of sub memories, and connecting sub memory management strings applied to use by an application program in series to form an application linked list, wherein the sizes of the sub memories of the memory block are defined as Si, i is equal to 1,2,3,...,M, and S1 is smaller than S2...than Sm; S2: according to the size S of the memory applied by the application program, applying for a sub memory Si greater than or equal to S, adding a sub memory node into the application linked list; S3: after the application program finishes using the memory, releasing the sub memory, and deleting the sub memory node in the application linked list; and S4: at a fixed period, scanning all sub memory nodes on the application linked list, and notifying the application program to process when the occupation time of one sub memory exceeds a memory life cycle. The method has the advantages of being simple in implementation, accurate in detection, high in practicality, accurate and reliable.

Description

The method and apparatus that in a kind of embedded system, diagnosing memory leak processes
Technical field
The invention belongs to computer technology application, the method and apparatus being specifically related in a kind of embedded system diagnosing memory leak and processing。
Background technology
Embedded system is the system that a kind of resource is more limited, the system resource that therefore how efficient multiplexing is limited, in particular how makes good use of limited memory source, plays maximum operational efficiency, becomes the key issue of embedded system performance。
In embedded system, most variations adopts dynamic memory management mode, and so-called Dram namely applies for internal memory in time, it is finished timely releasing memory, and program bug or personnel's carelessness often occur in this process, cause that internal memory cannot discharge, memory leak issue occurs, along with system long-play, internal memory, more with more few, finally can be used without internal memory, program eventually because there is no enough memory headrooms and cannot be properly functioning, causing that system runs quickly to burst to crash, consequence is very serious。Therefore, how automatically and efficiently accurately detection memory overflow reasonable releasing memory are difficult problems urgently to be resolved hurrily。
In the past, traditional Memory leakage detection and processing method, one is at debugging or test phase, use automatic testing software by internally depositing into row pitching pile, internal memory service condition is recorded in the data base of automatic testing software, artificial analysis judges whether memory overflow afterwards, and by hand inspection mode, memory leakage position is positioned;Two is judge whether the internal memory time shared by application program exceedes internal memory life cycle set in advance, when exceeding life cycle, it is judged that for there is memory overflow, and simple and crude ground forcible aborting internal memory。Referenced patent document CN101414272B discloses detection method and the device of a kind of memory overflow, by whether the current occupied time of detected internal memory exceedes in advance for being detected the life cycle of memory setting, and the business process whether detected internal memory is being applied detected internal memory is used, it is judged that whether tested internal memory leaks。
Traditional Memory leakage detection and processing method are excessively simple, relatively mechanical, and real-time is inadequate, and processing method underaction is appropriate, and effect is barely satisfactory in actual applications。And there is a lot of shortcoming: one is adopt pitching pile mode, can only carry out in debugging or test phase, it is impossible to formally disposing run duration in system and carry out Memory leakage detection, real-time is inadequate;Two is employing pitching pile mode, it is necessary to artificial analysis determines whether memory overflow, and artificially checks memory leak positioning position, a large amount of internal memory applications and the process of release, causes that investigation workload is big, and difficulty is high, and efficiency is low;Three is simply be judged as memory overflow by the life cycle of internal memory, there is erroneous judgement situation;Four is simple and crude ground forcible aborting internal memory, it is possible to causes that key function lost efficacy abnormal, affects user and normally use。
Summary of the invention
For the weak point that traditional Memory leakage detection processing method exists, the present invention proposes the method and apparatus that in a kind of embedded system, diagnosing memory leak processes。By the dynamic coordinate of memory management module Yu application program, automatically and efficiently Accurate Diagnosis memory overflow situation, reasonably distribute flexibly and releasing memory, it is to avoid simple and crude ground forcible aborting internal memory, cause that the disabler being currently running is abnormal。The present invention realizes simply, and detection is accurate, and processing method dynamic flexible has real-time height, practical, accurately and reliably, dynamic flexible, there is good using value and economic benefit。
The present invention adopts the following technical scheme that
A kind of method that in embedded system, diagnosing memory leak processes, the method comprises the following steps,
S1, is divided into the memory block varied in size by internal memory, and each memory block is divided into many sub-internal memories, and the sub-memory size of memory block i is defined as Si, i=1,2,3 ..., M, and S1<S2<…<SM, by application program sub-memory management be connected in series composition application chained list;
S2, the size S according to application program internal memory, apply for a sub-internal memory S be more than or equal to Si, and this sub-memory node is added in application chained list;
S3, after application program is finished internal memory, discharges this sub-internal memory, deletes this sub-memory node in application watch chain;
S4, with all sub-memory node on fixed cycle scanning application chained list, when a sub-EMS memory occupation time exceedes internal memory life cycle, notice application program processes。
Further, in step S2, application program tentatively applies for that the step of internal memory includes,
S210, starts retrieval from the memory block i=1 that sub-internal memory is minimum, retrieves memory block successively from small to large;
S211, it is judged that free memory number P in memory blockiWhether more than zero, if then jumping to step S212, then i=i+1 if not, it is judged that whether i is more than M, if i is more than M, applies for memory failure, if i is not more than M, then forwards step S211 to;
S212, it is judged that whether the size S of application application internal memory is less than or equal to sub-memory size SiIf, then the success of application internal memory, then i=i+1 if not, it is judged that whether i is more than M, if i is more than M, applies for memory failure, if i is not more than M, then forwards step S211 to。
Further, step S211 or the application memory failure penetration depth application internal memory step in step S212,
S220, all sub-memory node in retrieval request chained list, by sub-memory size SiIt is retrieved less than the sub-memory node of application internal memory priority more than application memory size S and sub-EMS memory occupation priority, retrieves and successfully forward step S221 to, retrieve and unsuccessfully then apply for memory failure;
S221, is defined as spare internal memory by the retrieval sub-internal memory that result medium priority is minimum and internal memory is minimum;
S222, release spare internal memory uses to the application program of present application, application internal memory success。
Further, in step S221, if the retrieval sub-internal memory that result medium priority is minimum and internal memory is minimum is more than one, then sub-internal memory the longest for holding time length is defined as spare internal memory。
Further, step S4 notifying, application program carries out process and includes extending internal memory life cycle or change EMS memory occupation priority or direct releasing memory, or application program memory overflow is automatically releasable internal memory。
The device that in a kind of embedded system, diagnosing memory leak processes, it includes,
Memory Allocation administrative unit, for internal memory is divided into the memory block varied in size, each memory block is divided into many sub-internal memories, and the sub-memory size of memory block i is defined as Si, i=1,2,3 ..., M, and S1<S2<…<SM, by application program sub-memory management be connected in series composition application chained list;
Internal memory application unit, for the size S according to application program internal memory, applies for a sub-internal memory S be more than or equal to Si, and this sub-memory node is added in application chained list;
Internal memory releasing unit, after being finished internal memory for application program, discharges this sub-internal memory, deletes this sub-memory node in application watch chain;
Memory diagnosis unit, for all sub-memory node on fixed cycle scanning application chained list, when a sub-EMS memory occupation time exceedes internal memory life cycle, notice application program processes。
Further, internal memory application unit includes tentatively application internal storage location and degree of depth application internal storage location。
Further, preliminary application internal storage location does not use one sub-internal memory be more than or equal to S of application in sub-internal memory for remaining from memory block。
Further, degree of depth application internal storage location, apply in preliminary application unit after unsuccessfully, by sub-memory size S from application chained listiAfter being retrieved less than the sub-memory node of application internal memory priority more than application memory size S and sub-EMS memory occupation priority, searching the sub-internal memory that priority is minimum and internal memory is minimum, the application program that this sub-internal memory is released to present application uses。
Further, the sub-internal memory that priority is minimum and internal memory is minimum is more than one, then the application program that sub-internal memory the longest for wherein holding time length is released to present application uses。
Further, notice application program carries out process and includes extending internal memory life cycle or change EMS memory occupation priority or direct releasing memory, or application program memory overflow is automatically releasable internal memory。
There is advantages that one is able in system operation automatically detect memory overflow situation, influential system is not properly functioning, and real-time is high, practical;Two are able to automatically and efficiently memory leak positioning point, are substantially reduced memory overflow investigation difficulty, and accurately and reliably, maintenance efficiency is high;Three is the dynamic negotiation by memory management module Yu application program, confirms memory overflow situation, and accuracy in detection is high;Four is the dynamic negotiation by memory management module Yu application program, confirms internal memory delivery mode, it is to avoid it is abnormal that forcible aborting internal memory causes that application function lost efficacy;Five is when low memory, according to memory applications grade, the internal memory that some priority ratios of forcible aborting are relatively low, it is ensured that high-priority applications function obtains properly functioning。
Accompanying drawing explanation
Fig. 1 is the structure chart of memory block;
Fig. 2 is the flow chart tentatively applying for internal memory;
Fig. 3 is the flow chart of degree of depth application internal memory;
Fig. 4 is vehicle comprehensive information service system figure。
Detailed description of the invention
For further illustrating each embodiment, the present invention is provided with accompanying drawing。These accompanying drawings are the part that the invention discloses content, and it is mainly in order to illustrate embodiment, and the associated description of description can be coordinated to explain the operation principles of embodiment。Coordinating with reference to these contents, those of ordinary skill in the art will be understood that other possible embodiments and advantages of the present invention。Assembly in figure is not necessarily to scale, and similar element numbers is conventionally used to indicate similar assembly。
In conjunction with the drawings and specific embodiments, the present invention is further described。
Consulting shown in Fig. 1 to Fig. 4, the present invention proposes a kind of method that in embedded system, diagnosing memory leak processes, and it comprises the following steps:
S1, is divided into the memory block varied in size by internal memory, and each memory block is divided into many sub-internal memories, and the sub-memory size of memory block i is defined as Si, i=1,2,3 ..., M, and S1<S2<…<SM, by application program sub-memory management be connected in series composition application chained list。
One internal memory is divided into different size of memory block, again each memory block is divided into sub-internal memory, between each memory block, sub-memory size is different, and same memory block neutron memory size is identical, and each memory block neutron internal memory is connected in series by a chained list management。
Each sub-internal memory includes head and internal memory, and header includes forwarding pointer, backwarding pointer, the source code file name of application internal memory and line number, internal memory life cycle, internal memory holding time, internal memory and uses mark, memory block numbering, EMS memory occupation priority, adjusts back Hook Function pointer。
Heretofore described priority refer to can self-defining EMS memory occupation priority, as: EMS memory occupation priority can be divided into high, normal, basic three grades: PRI1、PRI2、PRI3, wherein PRI1For lowest priority, PRI3For limit priority, application program when applying for internal memory, the needs according to the importance of different application function or the degree such as key, transmit different EMS memory occupation priority。
Chained list type include management chained list and application chained list, management chained list be each memory block will not use sub-memory management be connected in series, application chained list be by application program sub-memory management be connected in series。Management link table information includes pointing to total sub-internal memory number in pointer, memory block, residue available sub-internal memory number, sub-memory size。First available sub-internal memory of residue in the sensing pointed memory block of management chained list。
Shown in Fig. 1, for the structure chart of memory block。Memory block number definition be i (i=1,2,3 ..., M), memory block numbering size according to memory block neutron memory size arrange, from 1 to M。Therefore memory block BiMay be defined as B1、B2……BM, the management chained list L of memory blockiMay be defined as L1、L2……LM, application chained list is defined as L0, total sub-internal memory number N that each memory block is correspondingiMay be defined as N1、N2……NM, the residue that each memory block is corresponding can use sub-internal memory number PiMay be defined as P1、P2……PM, memory block B1、B2……BMCorresponding sub-memory size SiMay be defined as S1、S2……SM, and S1<S2<…<SM
S2, the size S according to application program internal memory, apply for a sub-internal memory S be more than or equal to Si, and this sub-memory node is added in application chained list。
When application program internal memory, except indicating application memory size, in addition it is also necessary to indicate the application source code file name of internal memory, line number, internal memory life cycle, EMS memory occupation priority, readjustment Hook Function。
Consulting shown in Fig. 2, for tentatively applying for the flow chart of internal memory, application program tentatively applies for that the step of internal memory includes,
S210, starts retrieval from the memory block i=1 that sub-internal memory is minimum, retrieves memory block successively from small to large。Namely from the memory block B that sub-internal memory is minimum1Start retrieval。
S211, it is judged that free memory number P in memory blockiWhether more than zero, if then jumping to step S212, then i=i+1 if not, it is judged that whether i is more than M, if i is more than M, then forwards step S214 to, if i is not more than M, then forwards step S211 to;
S212, the size S according to application program internal memory, it is judged that whether S is less than or equal to sub-memory size SiIf then application internal memory successfully forwards step S213 to, then i=i+1 if not, it is judged that whether i is more than M, if i is more than M, then forwards step S214 to, if i is not more than M, then forwards step S211 to。
S213, application internal memory success, the information of application passes be recorded in sub-internal memory header, and by this sub-internal memory from managing chained list LiMiddle deletion, is articulated to application chained list L0In。
S214, applies for memory failure, the then information according to application passes, the step of penetration depth application internal memory。
Consulting shown in Fig. 3, for the flow chart of degree of depth application internal memory, the step of degree of depth application internal memory includes,
S220, all sub-memory node in retrieval request chained list, by sub-memory size SiIt is retrieved less than the sub-memory node of application internal memory priority more than application memory size S and sub-EMS memory occupation priority, retrieves and successfully forward step S221 to, retrieve and unsuccessfully then apply for memory failure。
S221, is defined as spare internal memory by the retrieval sub-internal memory that result medium priority is minimum and internal memory is minimum。The sub-memory node satisfied condition will be retrieved, arrange according to priority and memory size, obtaining the sub-memory node that priority is minimum and internal memory is minimum is spare internal memory, if there is the sub-memory node that multiple priority is minimum and internal memory is minimum, then further according to sub-internal memory holding time length, obtaining the longest sub-memory node of holding time length is spare internal memory, forwards step S222 to。
S222, release spare internal memory uses to the application program of present application, application internal memory success。By the readjustment Hook Function of record in this sub-internal memory header, notice this internal memory of application program will be released, and application program carries out rehabilitation, no longer takies this internal memory, releases this and puts spare internal memory。
S223, uses the sub-internal memory of release to the application program of present application, updates sub-internal memory header, returns。
S3, after application program is finished internal memory, discharges this sub-internal memory, deletes this sub-memory node in application watch chain, and this sub-internal memory mounts back corresponding management chained list。
S4, with all sub-memory node on fixed cycle scanning application chained list, when a sub-EMS memory occupation time exceedes internal memory life cycle, notice application program processes。
With certain time interval T real time scan application chained list, check each sub-memory node in application chained list, accumulative each sub-memory node holding time, when the EMS memory occupation time exceedes internal memory life cycle, process is performed by sub-internal memory header is adjusted back Hook Function notice application program, by application program dynamic negotiation, application program can change prolongation internal memory life cycle as required, or change EMS memory occupation priority, or directly releasing memory, or application program judges really as memory overflow and is automatically releasable internal memory, in data base, record preserves source code file name memory overflow occur, line number, the information such as time, it is accurately positioned memory overflow part, it is easy to program maintenance amendment。
The invention allows for the device that in a kind of embedded system, diagnosing memory leak processes, it includes,
Memory Allocation administrative unit, for internal memory is divided into the memory block varied in size, each memory block is divided into many sub-internal memories, and the sub-memory size of memory block i is defined as Si, i=1,2,3 ..., M, and S1<S2<…<SM, by application program sub-memory management be connected in series composition application chained list;
Internal memory application unit, for the size S according to application program internal memory, applies for a sub-internal memory Si be more than or equal to S, and is added to by this sub-memory node in application chained list;
Internal memory releasing unit, after being finished internal memory for application program, discharges this sub-internal memory, deletes this sub-memory node in application watch chain;
Memory diagnosis unit, for all sub-memory node on fixed cycle scanning application chained list, when a sub-EMS memory occupation time exceedes internal memory life cycle, notice application program processes。
Wherein, internal memory application unit includes tentatively application internal storage location and degree of depth application internal storage location。Preliminary application internal storage location does not use one sub-internal memory be more than or equal to S of application in sub-internal memory for remaining from memory block。
Degree of depth application internal storage location, applies for after unsuccessfully in preliminary application unit, by sub-memory size S from application chained listiAfter being retrieved less than the sub-memory node of application internal memory priority more than application memory size S and sub-EMS memory occupation priority, searching the sub-internal memory that priority is minimum and internal memory is minimum, the application program that this sub-internal memory is released to present application uses。When the sub-internal memory that priority is minimum and internal memory is minimum is more than one, then the application program that sub-internal memory the longest for wherein holding time length is released to present application uses。
It should be noted that notice application program carries out process includes extending internal memory life cycle or change EMS memory occupation priority or direct releasing memory, or application program memory overflow is automatically releasable internal memory。
Consult shown in Fig. 4, be a vehicle integrated service system figure including the present invention, this system include with HD recording, the Big Dipper location, mobile communication function Big Dipper video traveling recorder, vehicle and the Big Dipper fortune supervisory operation center service system。Wherein Big Dipper video traveling recorder can collection vehicle sensor signal, the Big Dipper location, mobile communication and video record storage, be carry out business datum communication by 4G network between Big Dipper video traveling recorder and center service system。System sets forth the application of the present invention by following practical application scene。
Big Dipper video traveling recorder is a main process equipment being arranged on vehicle, contains the subsystem of microprocessor, memory RAM, Flash, acceleration transducer, signals of vehicles collection, hard disk, mobile communication module and satellite positioning module。Primarily serve the functions such as mobile network's RFDC, satellite positioning functions, signals of vehicles collection, magnitude of vibrations detection and video record storage。Microprocessor chip adopts Huawei Company's Hi3520D chip, signals collecting sensor adopts photoelectric coupled circuit collection vehicle ignition trigger signal, video acquisition module adopts Techwell company's T W2968 chip, it is attached by coaxial cable between photographic head and video acquisition module, is connected by SATA interface between hard disk with MCU。
Center service system is an application software based on server, for receiving, resolve, process the data that Big Dipper video traveling recorder is uploaded, analytical data, generates and jolts traffic information data base, can remotely monitor simultaneously, remote control, configuration Big Dipper video traveling recorder。
Vehicle Sensor System is mounted in the various sensing system of vehicle, externally provides the interfaces such as pulse collection sensor, signals of vehicles sensor, and other control panels can pass through pickup wire and dock with Vehicle Sensor System, it is achieved signals of vehicles data acquisition。Acceleration transducer is for detecting magnitude of vibrations in vehicle travel process。
Big Dipper video traveling recorder integrates mobile communication, BD/GPS dual mode satellite location, video record storage function, is realized by digital mobile communication network and global satellite positioning that the monitoring remote video to vehicle manage, location application manages and warning is sought help correlation function。Big Dipper video traveling recorder is arranged on vehicle centre console position, in vehicle travel process, microprocessor constantly gathers location information data, vehicle sensor signal, image information and video information, the image information collected and video information are stored in hard disk, 4G network can also be passed through simultaneously and upload to center service system in real time, retrieve when being available for car operation management unit and check video file in hard disk。Owing to image information and video information data amount are very big, it is thus desirable to adopt the mode of Dram to realize internal memory share time-sharing multiplex, but when taking due to internal memory application, application program also cannot know for sure when application the precise time taken required for internal memory, as data are uploaded by network, network signal quality dynamically will affect the EMS memory occupation time, while in system operation, between system, critical data needs successfully to apply for Dram in time alternately, to ensure that system is properly functioning。Adopt the method that in a kind of embedded system of present invention proposition, diagnosing memory leak processes, automatically and efficiently can accurately detect memory leak issue reasonable releasing memory, it is able to ensure that high priority function successfully applies for that internal memory is able to by dynamic negotiation properly functioning, without causing that low-priority functions is abnormal, the function for Big Dipper video traveling recorder provides basic guarantee。
Although specifically showing in conjunction with preferred embodiment and describing the present invention; but those skilled in the art should be understood that; in the spirit and scope without departing from appended claims invention defined; the present invention can be made a variety of changes in the form and details, be protection scope of the present invention。

Claims (11)

1. the method that in an embedded system, diagnosing memory leak processes, it is characterised in that: the method comprises the following steps,
S1, is divided into the memory block varied in size by internal memory, and each memory block is divided into many sub-internal memories, and the sub-memory size of memory block i is defined as Si, i=1,2,3 ..., M, and S1<S2<…<SM, by application program sub-memory management be connected in series composition application chained list;
S2, the size S according to application program internal memory, apply for a sub-internal memory S be more than or equal to Si, and this sub-memory node is added in application chained list;
S3, after application program is finished internal memory, discharges this sub-internal memory, deletes this sub-memory node in application watch chain;
S4, with all sub-memory node on fixed cycle scanning application chained list, when a sub-EMS memory occupation time exceedes internal memory life cycle, notice application program processes。
2. the method that in embedded system as claimed in claim 1, diagnosing memory leak processes, it is characterised in that: in described step S2, application program tentatively applies for that the step of internal memory includes,
S210, starts retrieval from the memory block i=1 that sub-internal memory is minimum, retrieves memory block successively from small to large;
S211, it is judged that free memory number P in memory blockiWhether more than zero, if then jumping to step S212, then i=i+1 if not, it is judged that whether i is more than M, if i is more than M, applies for memory failure, if i is not more than M, then forwards step S211 to;
S212, it is judged that whether the size S of application application internal memory is less than or equal to sub-memory size SiIf, then the success of application internal memory, then i=i+1 if not, it is judged that whether i is more than M, if i is more than M, applies for memory failure, if i is not more than M, then forwards step S211 to。
3. the method that in embedded system as claimed in claim 2, diagnosing memory leak processes, it is characterised in that: the application memory failure penetration depth application internal memory step in described step S211 or step S212,
S220, all sub-memory node in retrieval request chained list, by sub-memory size SiIt is retrieved less than the sub-memory node of application internal memory priority more than application memory size S and sub-EMS memory occupation priority, retrieves and successfully forward step S221 to, retrieve and unsuccessfully then apply for memory failure;
S221, is defined as spare internal memory by the retrieval sub-internal memory that result medium priority is minimum and internal memory is minimum;
S222, release spare internal memory uses to the application program of present application, application internal memory success。
4. the method that in embedded system as claimed in claim 3, diagnosing memory leak processes, it is characterized in that: in described step S221, if the retrieval sub-internal memory that result medium priority is minimum and internal memory is minimum is more than one, then sub-internal memory the longest for holding time length is defined as spare internal memory。
5. the method that in embedded system as claimed in claim 1, diagnosing memory leak processes, it is characterized in that: described step S4 notifying, application program carries out process and includes extending internal memory life cycle, or change EMS memory occupation priority, or directly releasing memory, or application program memory overflow is automatically releasable internal memory。
6. the device that in an embedded system, diagnosing memory leak processes, it is characterised in that: it includes,
Memory Allocation administrative unit, for internal memory is divided into the memory block varied in size, each memory block is divided into many sub-internal memories, and the sub-memory size of memory block i is defined as Si, i=1,2,3 ..., M, and S1<S2<…<SM, by application program sub-memory management be connected in series composition application chained list;
Internal memory application unit, for the size S according to application program internal memory, applies for a sub-internal memory S be more than or equal to Si, and this sub-memory node is added in application chained list;
Internal memory releasing unit, after being finished internal memory for application program, discharges this sub-internal memory, deletes this sub-memory node in application watch chain;
Memory diagnosis unit, for all sub-memory node on fixed cycle scanning application chained list, when a sub-EMS memory occupation time exceedes internal memory life cycle, notice application program processes。
7. the device that in embedded system as claimed in claim 6, diagnosing memory leak processes, it is characterised in that: described internal memory application unit includes tentatively application internal storage location and degree of depth application internal storage location。
8. the device that in embedded system as claimed in claim 7, diagnosing memory leak processes, it is characterised in that: described preliminary application internal storage location does not use one sub-internal memory be more than or equal to S of application in sub-internal memory for remaining from memory block。
9. the device that in embedded system as claimed in claim 7, diagnosing memory leak processes, it is characterised in that: described degree of depth application internal storage location, apply in preliminary application unit after unsuccessfully, by sub-memory size S from application chained listiAfter being retrieved less than the sub-memory node of application internal memory priority more than application memory size S and sub-EMS memory occupation priority, searching the sub-internal memory that priority is minimum and internal memory is minimum, the application program that this sub-internal memory is released to present application uses。
10. the device that in embedded system as claimed in claim 9, diagnosing memory leak processes, it is characterized in that: the sub-internal memory that described priority is minimum and internal memory is minimum is more than one, then the application program that sub-internal memory the longest for wherein holding time length is released to present application uses。
11. the device that in embedded system as claimed in claim 6, diagnosing memory leak processes, it is characterized in that: described notice application program carries out process and includes extending internal memory life cycle, or change EMS memory occupation priority, or directly releasing memory, or application program memory overflow is automatically releasable internal memory。
CN201610015205.6A 2016-01-11 2016-01-11 Method and device for memory leakage diagnosis processing in embedded system Pending CN105700968A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610015205.6A CN105700968A (en) 2016-01-11 2016-01-11 Method and device for memory leakage diagnosis processing in embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610015205.6A CN105700968A (en) 2016-01-11 2016-01-11 Method and device for memory leakage diagnosis processing in embedded system

Publications (1)

Publication Number Publication Date
CN105700968A true CN105700968A (en) 2016-06-22

Family

ID=56227167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610015205.6A Pending CN105700968A (en) 2016-01-11 2016-01-11 Method and device for memory leakage diagnosis processing in embedded system

Country Status (1)

Country Link
CN (1) CN105700968A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095689A (en) * 2016-06-24 2016-11-09 北京奇虎科技有限公司 The detection method of a kind of application memory leakage and device
CN107145582A (en) * 2017-05-09 2017-09-08 深圳Tcl新技术有限公司 The control method and Database Systems of database cursor
CN107168804A (en) * 2017-05-31 2017-09-15 上海联影医疗科技有限公司 A kind of memory source management method and system
CN112860574A (en) * 2021-03-15 2021-05-28 北京车和家信息技术有限公司 Memory leakage detection method and device, medium and equipment of Linux kernel

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050235127A1 (en) * 2004-04-19 2005-10-20 Cisco Technology, Inc. Method and system for memory leak detection
CN1722106A (en) * 2004-07-13 2006-01-18 中兴通讯股份有限公司 Method for internal memory allocation in the embedded real-time operation system
CN1770125A (en) * 2004-11-04 2006-05-10 华为技术有限公司 Memory allocation method
CN1936859A (en) * 2005-09-30 2007-03-28 康佳集团股份有限公司 Internal memory monitoring method
CN101414272A (en) * 2008-10-17 2009-04-22 上海华为技术有限公司 Method and apparatus for detecting memory leakage
CN102053868A (en) * 2009-11-04 2011-05-11 突触计算机系统(上海)有限公司 Memory leak detection method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050235127A1 (en) * 2004-04-19 2005-10-20 Cisco Technology, Inc. Method and system for memory leak detection
CN1722106A (en) * 2004-07-13 2006-01-18 中兴通讯股份有限公司 Method for internal memory allocation in the embedded real-time operation system
CN1770125A (en) * 2004-11-04 2006-05-10 华为技术有限公司 Memory allocation method
CN1936859A (en) * 2005-09-30 2007-03-28 康佳集团股份有限公司 Internal memory monitoring method
CN101414272A (en) * 2008-10-17 2009-04-22 上海华为技术有限公司 Method and apparatus for detecting memory leakage
CN102053868A (en) * 2009-11-04 2011-05-11 突触计算机系统(上海)有限公司 Memory leak detection method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
凌明: "《嵌入式系统高级C语言编程》", 31 December 2011, 北京航空航天大学出版社 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095689A (en) * 2016-06-24 2016-11-09 北京奇虎科技有限公司 The detection method of a kind of application memory leakage and device
CN107145582A (en) * 2017-05-09 2017-09-08 深圳Tcl新技术有限公司 The control method and Database Systems of database cursor
CN107168804A (en) * 2017-05-31 2017-09-15 上海联影医疗科技有限公司 A kind of memory source management method and system
CN112860574A (en) * 2021-03-15 2021-05-28 北京车和家信息技术有限公司 Memory leakage detection method and device, medium and equipment of Linux kernel
CN112860574B (en) * 2021-03-15 2024-02-20 北京车和家信息技术有限公司 Memory leakage detection method and device, medium and equipment for Linux kernel

Similar Documents

Publication Publication Date Title
CN105700968A (en) Method and device for memory leakage diagnosis processing in embedded system
US7340331B2 (en) Vehicle data recorder using digital and analog diagnostic data
US8732530B2 (en) System and method for self-diagnosis and error reporting
US8181161B2 (en) System for automatically collecting trace detail and history data
US7813852B2 (en) System mounted on a vehicle, vehicle, diagnosis information collecting device and navigation device
TWI410897B (en) Information recording system and information recording method
CN103529761B (en) A kind of new energy vehicle fault data acquisition method and apparatus
JP2023051756A (en) Vehicle data collection system and method of using the same
CN106997316A (en) Detecting system and method that memory abnormal increases
CN111754654A (en) Vehicle-mounted video storage method, reading method, storage device and reading device
CN110287470B (en) Urban rail transit vehicle hook buffer device detection form generation system
CN111813590A (en) Method and device for diagnosing abnormal reset of main control module and main control module
WO2007038983A1 (en) Analysis of vehicle diagnostic data stream using a recorded movie of the data stream
CN114511193A (en) Method, device, medium and equipment for early warning of risks of orders and vehicle tracks
CN112874378B (en) Method, device and equipment for processing battery sampling temperature and vehicle
CN109885036A (en) It a kind of vehicle and its closes weight signal and shows and the device and method of fault diagnosis
CN109460994A (en) A kind of transaction journal data detection method, device, equipment and readable storage medium storing program for executing
CN116680165B (en) Interface performance testing method, device and equipment
CN112363883A (en) CPU pressure testing method and device
CN106844211A (en) A kind of method for testing software, apparatus and system
CN207909338U (en) Scientific and technological overload remediation overrun and overload high speed dynamic weighing evidence-obtaining system
CN111159051A (en) Deadlock detection method and device, electronic equipment and readable storage medium
CN115858456A (en) Data acquisition system and method for automatic driving vehicle
CN109032827A (en) It is a kind of to track the test macro and method for leading to memory overflow exception
CN109240747A (en) A kind of information inspection method and its relevant apparatus of multistage server management system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160622