Nothing Special   »   [go: up one dir, main page]

CN110334031A - Memory Allocation code detection method, device, computer equipment and storage medium - Google Patents

Memory Allocation code detection method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110334031A
CN110334031A CN201910642148.8A CN201910642148A CN110334031A CN 110334031 A CN110334031 A CN 110334031A CN 201910642148 A CN201910642148 A CN 201910642148A CN 110334031 A CN110334031 A CN 110334031A
Authority
CN
China
Prior art keywords
code
memory allocation
intermediate language
detected
instruction
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
CN201910642148.8A
Other languages
Chinese (zh)
Other versions
CN110334031B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910642148.8A priority Critical patent/CN110334031B/en
Publication of CN110334031A publication Critical patent/CN110334031A/en
Application granted granted Critical
Publication of CN110334031B publication Critical patent/CN110334031B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

This application discloses a kind of Memory Allocation code detection method, device, computer equipment and storage mediums, in this scenario, computer equipment is after the intermediate language code for getting application code to be detected, determine instruction code is the target intermediate language code of target instruction target word code in intermediate language code to be detected, finally by location information of the corresponding source code of target intermediate language code in application code to be detected is determined, that is, it can determine location information of the Memory Allocation code in application code to be detected.As it can be seen that the program is the location information that can determine Memory Allocation code in application program to be detected by target intermediate language code.And Memory Allocation code detection method provided by the present application is without running application program, without every kind of operational circumstances of exhaustive application program, therefore it is easy to operate, it can also be to avoid the incomplete problem of Memory Allocation code detection.

Description

Memory Allocation code detection method, device, computer equipment and storage medium
Technical field
This application involves technical field of data processing more particularly to a kind of Memory Allocation code detection methods, device, calculating Machine equipment and storage medium.
Background technique
Application program would generally carry out storing data using memory at runtime, when stored data is no longer used, GC (Garbage Collection, garbage reclamation) mechanism can discharge the occupied memory headroom of these data, so that this portion Divide memory headroom that can continue to be used.
During application program operation, if Memory Allocation operation is excessive or excessively frequent, rubbish will be triggered Recycling, and garbage reclamation will cause therefore how the bad performances such as operation Caton detect memory in application code Code is distributed, is those skilled in the art's technical issues that need to address.
Summary of the invention
In view of this, this application provides a kind of Memory Allocation code detection method, device, computer equipment and storages to be situated between Matter, to detect Memory Allocation code in application code.
To achieve the above object, on the one hand, this application provides a kind of Memory Allocation code detection methods, comprising:
Obtain intermediate language code to be detected, the intermediate language code to be detected be to application code to be detected into The intermediate language code that row compiling obtains;
Determine instruction code is the target intermediate language code of target instruction target word code in the intermediate language code to be detected;Institute State the instruction code that target instruction target word code is corresponding Memory Allocation code;
Memory Allocation coded positional information, the Memory Allocation code position are determined using the target intermediate language code Information is location information of the Memory Allocation code in the application code to be detected.
Optionally, described to determine Memory Allocation code described to be detected using journey using the target intermediate language code After Memory Allocation coded positional information in sequence code, further includes:
Determine that last modification account, the last modification account are finally to repair using the Memory Allocation coded positional information Change the account of every row Memory Allocation code;
To the corresponding Memory Allocation code bit confidence of each last corresponding Code Edit system transmission of modification account Breath and Memory Allocation code revision instruction, so that the Code Edit system modifies to the Memory Allocation code.
Optionally, described to send Memory Allocation code to the corresponding Code Edit system of each last modification account and repair Change instruction and corresponding Memory Allocation coded positional information, comprising:
It is sent using the API of preset task dissemination system to the corresponding Code Edit system of each last modification account Memory Allocation code revision instructs and corresponding Memory Allocation coded positional information.
It is optionally, described to determine Memory Allocation coded positional information using the target intermediate language code, comprising:
Determine Memory Allocation code in the application code to be detected using the target intermediate language code Line number and affiliated function name.
Another aspect, this application provides a kind of Memory Allocation code detection systems, comprising:
Intermediate language code to be detected obtains module, for obtaining intermediate language code to be detected;The centre to be detected Language codes are the intermediate language code being compiled to application code to be detected;
Target intermediate language code determining module, being used for the determine instruction code in the intermediate language code to be detected is mesh Mark the target intermediate language code of instruction code;The target instruction target word code is the instruction code of corresponding Memory Allocation code;
Location information determining module, for determining Memory Allocation code bit confidence using the target intermediate language code Breath, the Memory Allocation coded positional information are position letter of the Memory Allocation code in the application code to be detected Breath.
Another aspect, present invention also provides a kind of computer equipments, comprising:
Processor and memory;
Wherein, the processor is for executing the program stored in the memory;
For storing program, described program is at least used for the memory:
Obtain intermediate language code to be detected;Wherein, the intermediate language code to be detected is to application program to be detected The intermediate language code that code is compiled;
Determine instruction code is the target intermediate language code of target instruction target word code in the intermediate language code to be detected;Its In, the target instruction target word code is the instruction code of corresponding Memory Allocation code;
Memory Allocation coded positional information, the Memory Allocation code position are determined using the target intermediate language code Information is location information of the Memory Allocation code in the application code to be detected.
It is executable to be stored with computer present invention also provides a kind of storage medium for another aspect in the storage medium Instruction when the computer executable instructions are loaded and executed by processor, realizes the Memory Allocation of the application any embodiment Code detection method.
As it can be seen that in this application, obtaining the intermediate language to be detected obtained after application code compiling to be detected first Code, due to including the instruction code for being able to reflect machine practical operation content in intermediate language code, pass through matching instruction The mode of code can determine that Memory Allocation operates corresponding target intermediate language code, and since intermediate language code is by answering It compiles to obtain with program code, there is corresponding relationship therebetween, to can determine by target intermediate language code to be checked Survey the location information of Memory Allocation code in application program.And Memory Allocation code detection method provided by the embodiments of the present application Without running application program, without every kind of operational circumstances of exhaustive application program, therefore it is easy to operate, it can also be to avoid memory Distribute the incomplete problem of code detection.
Detailed description of the invention
In order to more clearly explain the technical solutions in the embodiments of the present application, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is only embodiments herein, for ability For the those of ordinary skill of domain, without creative efforts, it can also be obtained according to the attached drawing of offer other Attached drawing.
A kind of hardware that Memory Allocation code detection method is applicable in composition frame that Fig. 1 shows the embodiment of the present application shows It is intended to;
Fig. 2 shows a kind of a kind of flow diagrams of Memory Allocation code detection method of the embodiment of the present application;
Fig. 3 shows a kind of a kind of flow diagram of Memory Allocation code detection method of the embodiment of the present application;
Fig. 4 shows a kind of determination flow diagram of Memory Allocation coded positional information of the embodiment of the present application;
Fig. 5 shows a kind of a kind of flow diagram of Memory Allocation code detection method of the embodiment of the present application;
Fig. 6 shows a kind of a kind of flow diagram of Memory Allocation code detection method of the embodiment of the present application;
Fig. 7 shows a kind of corresponding system schematic of application scenarios embodiment of the embodiment of the present application;
Fig. 8 shows a kind of composed structure of one embodiment of Memory Allocation code detection system of the embodiment of the present application Show block diagram;
Fig. 9 shows a kind of composed structure schematic diagram of one embodiment of computer equipment of the embodiment of the present application.
Specific embodiment
During application program operation, if Memory Allocation operation is excessive or excessively frequent, rubbish will be triggered Recycling, and garbage reclamation will cause therefore how the bad performances such as operation Caton detect memory in application code Code is distributed, is those skilled in the art's technical issues that need to address.Currently, all due to the source code including Memory Allocation code It is that a kind of function and is realized using high-level language by high level language, such as realizes Memory Allocation operation, corresponding code Redaction rule is very diversified, and same written in code rule may be also suitable a variety of different functions, furthermore a kind of function Realizing for energy even can be by way of calling various encapsulation packages, and making source code part, there is no actual function codes, that is, practical The code of function is realized there is no directly displaying, so can not directly detect Memory Allocation code from source code at present.
Existing Memory Allocation code detection method is usually to use dynamic detection mode, and application program is run Come, by attempting various operating statuses, exhaustive all operations that can be carried out to application program are found and Memory Allocation operation occur The case where, and according to finding corresponding source code the case where there is Memory Allocation operation, but this mode is dependent on application program Operating status, and the operational circumstances attempted, test job amount is very big, and if that attempts is not comprehensive enough, cannot Detect all Memory Allocation codes.And this programme provides a kind of Memory Allocation code detection method, can facilitate detection institute Some Memory Allocation codes.
In order to make it easy to understand, the hardware that first the corresponding scheme of the memory allocation method of the application is applicable in form frame into Row is introduced.It may refer to Fig. 1, wherein Fig. 1 shows a kind of hardware group that Memory Allocation code detection method is applicable in of the application At block schematic illustration.
Referring to FIG. 1, as shown in Figure 1, hardware composition frame may include: the first computer equipment 101 and the second meter Machine equipment 102 is calculated, wherein the first computer equipment 101 is the equipment for realizing Memory Allocation code detection function, Ke Yiyou One or more, second computer equipment 102 is the equipment for writing application code to be detected, can equally there is one Or more than one.Communication connection is realized by network 103 between first computer equipment 101 and second computer equipment 102.
It is understood that not being defined to the quantity of computer equipment in the embodiment of the present application, can be more A computer equipment cooperate jointly complete Memory Allocation code detection function, for example, the code of an application program be divided into it is more A project or module, a computer equipment are responsible for the detection function of the Memory Allocation code of a project or module.In one kind May in the case where, referring to FIG. 1, as shown in Figure 1, hardware composition frame may include: the first computer equipment 101 and the Two computer equipments 102, wherein the first computer equipment 101 is the equipment for realizing Memory Allocation code detection function, it can To there is one or more, second computer equipment 102 is the equipment for writing application code to be detected, can equally be had One or more.Communication link is realized by network 103 between first computer equipment 101 and second computer equipment 102 It connects.
In the case where a kind of possible, it can also only include first computer equipment 101 which, which forms frame, the One computer equipment 101 had not only had the function of Memory Allocation code detection, but also had the function of that application program to be detected is write, Huo Zhe One computer equipment 101 is previously stored with application program to be detected.
In the case where alternatively possible, it can only include more the first computer equipments 101 which, which forms frame, and It does not include second computer equipment 102, more the first computer equipments 101 can mutually be transmitted to be detected by network interconnection Application code, and Memory Allocation code detection operation is carried out to the application program to be detected received.
In the embodiment of the present application, simultaneously including the frame of the first computer equipment 101 and second computer equipment 102 For be introduced, it can be understood as tool there are two computer equipment, the two carries out data interaction in the present embodiment, realizes memory Distribute code function.Further, the form of network 103 is not defined in the embodiment of the present application, e.g., network 103 can be with It is wireless network (such as WIFI, bluetooth), is also possible to cable network;Either internet, is also possible to local area network, for The considerations of data transmission security, preferably local area network.
Wherein, the first computer equipment 101 and second computer equipment 102 can be same computer equipment, and such as the One computer equipment 101 and second computer equipment 102 are server;It is also possible to different types of computer equipment, e.g., First computer equipment 101 can be server apparatus, and second computer equipment 102 can be with terminal device.It is possible at another In the case where, can use the strong server of computing capability as the first computer equipment 101 improve data-handling efficiency and Reliability, thus first computer equipment can the application code to be detected to more second computer equipment carry out Detection.
For example, referring to FIG. 2, second computer equipment 102 is sent out after obtaining application code to be detected It send to the first computer equipment 101, the first computer equipment 101 is compiled to obtain to be detected to application code to be detected Intermediate language code, determine instruction code is the target intermediate language code of target instruction target word code in intermediate language code to be detected, It, can be true finally by location information of the corresponding source code of target intermediate language code in application code to be detected is determined Determine location information of the Memory Allocation code in application code to be detected.
In the case where a kind of possible, the first computer equipment 101, can after the location information for determining Memory Allocation code Location information is sent to second computer equipment 102, so that second computer equipment 102 modifies the memory point of corresponding position With code.To make Memory Allocation code that can not only be facilitated, comprehensively be detected, also it can make Memory Allocation code can Timely to be modified.
In conjunction with the above general character, referring to Fig. 3, it illustrates a kind of Memory Allocation code detection method one embodiment of the application Flow chart, the method for the present embodiment may include:
S101, obtains intermediate language code to be detected, and the intermediate language code to be detected is to application program to be detected The intermediate language code that code is compiled.
Wherein, intermediate language code (Intermediate Language, IL) is by specific compilation tool to advanced The code that language source code (source code of such as C#, VB, F#) is compiled.The machine that intermediate language code is executed closer to machine Code can determine the concrete operations that machine needs to be implemented, that is to say, that compared to high-level source code from intermediate language code For, intermediate language code more can directly reflect the corresponding practical operation of code.
The intermediate language code to be detected that the embodiment of the present application obtains is compiled to application code to be detected The intermediate language code arrived.
It is a kind of may in the case where, compilation tool selects mono.cecil, and mono.cecil is an open source library, can be with Higher-level language code is translated, corresponding intermediate language code is obtained.Application code to be detected is with the lattice of dll file Formula storage, is compiled by dll file of the mono.cecil to application code to be detected, that is, is produced and answered with to be detected With the corresponding intermediate language code to be detected of program code.
Application code to be detected is high-level source code, and compilation operations can be carried out by the machine, that is, can be The equipment for executing Memory Allocation code detection method carries out, and can also be carried out by other equipment, and passes through communication interface or defeated Enter unit to save into the machine.
S102, determine instruction code is the target intermediate language generation of target instruction target word code in the intermediate language code to be detected Code;The target instruction target word code is the instruction code of corresponding Memory Allocation code.
Intermediate language code includes instruction code (OpCodes), and instruction code corresponds to the practical operation mark of machine execution.Example Such as, instruction code is the intermediate language code of BOX, and corresponding operation content is that value class is converted to object reference (O type).It is logical The instruction code of intermediate language code is crossed, that is, can determine the corresponding practical operation content of every row intermediate language code.
In the present solution, predefining the instruction code of corresponding Memory Allocation operation, that is, determine target instruction target word code.In target Between in language codes, that is, intermediate language code to be detected, the code of corresponding Memory Allocation operation.
Optionally, target instruction target word code include box instruct corresponding instruction code, newarr instruct corresponding instruction code and Newobj instructs corresponding instruction code, that is to say, that instruction code is the intermediate language of box or newarr or newobj, by machine The result of execution is Memory Allocation operation.
In the case where a kind of possible, target instruction target word code is saved by way of list, saves the list of target instruction target word code As list of matches.It, successively will be every in intermediate language code when determining target intermediate language code in intermediate language code A instruction code is matched with the target instruction target word code in list of matches, and determines the instruction code corresponding intermediate language generation in matching Code, which is target intermediate language code.
It should be noted that target instruction target word code can also increase according to actual needs, be deleted or modified, that is, can be according to reality Border situation modification list.
In embodiment, application program is not specifically limited, such as can be game, application code to be detected can To be based on unity engine and to utilize the game identification code of C# language exploitation.
S103 determines Memory Allocation coded positional information, the Memory Allocation generation using the target intermediate language code Code position information is location information of the Memory Allocation code in the application code to be detected.
Since intermediate language code is the code being compiled to application code, intermediate language code There are corresponding relationship between application code, Memory Allocation operates corresponding target intermediate language code, corresponding to answer It is Memory Allocation code with program code.It can determine application program generation to be detected using intermediate language code in this programme The position of Memory Allocation code in code.
In a kind of possible situation, the embodiment of the present application can use the corresponding symbol text of application code to be detected Part determines the location information of Memory Allocation code corresponding with target intermediate language code.Symbol file (Symbol Files) It is a data information file, in Windows system, symbol file is using .pdb as extension name.Symbol file contains application Binary file (such as EXE, DLL etc.) Debugging message of program, is dedicated as debugging, all variable informations in application program It all records in this document.The inside of application program can be traced by symbol file, can also according to symbol file come Determine location information of the corresponding Memory Allocation code of target intermediate language code in application code.
In the embodiment of the present application, the intermediate language to be detected obtained after application code compiling to be detected is obtained first Code, due to including the instruction code for being able to reflect machine practical operation content in intermediate language code, pass through matching instruction The mode of code can determine that Memory Allocation operates corresponding target intermediate language code, and since intermediate language code is by answering It compiles to obtain with program code, there is corresponding relationship therebetween, to can determine by target intermediate language code to be checked Survey the location information of Memory Allocation code in application program.And Memory Allocation code detection method provided by the embodiments of the present application Without running application program, without every kind of operational circumstances of exhaustive application program, therefore it is easy to operate, it can also be to avoid memory Distribute the incomplete problem of code detection.
In the case where a kind of possible, target intermediate language code corresponding to target instruction target word code, is not fully memory Distribute code corresponding intermediate language code, that is, there are a kind of situations to be, for realizing the intermediate language of non-Memory Allocation function Code, instruction code are also target instruction target word code, such as using the intermediate language code of such non-Memory Allocation function as target among Language codes, then its corresponding application code to be detected is detected as Memory Allocation code, then Memory Allocation The determination range of code is excessive, not accurate enough, increases the work of later period modification Memory Allocation code.To solve this problem, originally Apply for that embodiment is really customized to Memory Allocation coded positional information to go out further to limit and explanation.
Fig. 4 is referred to, constant current journey is as follows really for the present embodiment Memory Allocation coded positional information:
S201 determines the target intermediate language code including Memory Allocation instruction in the target intermediate language code.
It wherein, had not only included instruction code in every row intermediate language code, but also including command content, in order to more accurately match The corresponding target intermediate language code of Memory Allocation code, the embodiment of the present application are being matched to target intermediate language according to instruction code After code, it is also necessary to which the actual instruction information matches according to target intermediate language code include among the target of Memory Allocation instruction Language.
S202 determines Memory Allocation code bit confidence using the target intermediate language code including Memory Allocation instruction Breath.
It can be by by command content matching including further memory in language between in the target in the embodiment of the present application The target intermediate language code of instruction is distributed, to determine corresponding Memory Allocation code bit according to such target intermediate language code Confidence breath, can make result more accurate.
In the case where a kind of possible, in order to modify the Memory Allocation code detected timely, in this Shen Please be in embodiment, it can be by determining the last modification account of Memory Allocation code, and according to last modification account to corresponding Code Edit system sends code revision instruction and Memory Allocation coded positional information, so that corresponding reviser be made to repair in time Change Memory Allocation code.
Fig. 5 is referred to, it illustrates a kind of Memory Allocation code detections of the application it illustrates a kind of Memory Allocation code The flow diagram of the another embodiment of method, the method for the present embodiment may include:
S301, obtains intermediate language code to be detected, and the intermediate language code to be detected is to application program to be detected The intermediate language code that code is compiled.
S302, determine instruction code is the target intermediate language generation of target instruction target word code in the intermediate language code to be detected Code;The target instruction target word code is the instruction code of corresponding Memory Allocation code.
S303 determines Memory Allocation coded positional information, the Memory Allocation generation using the target intermediate language code Code position information is location information of the Memory Allocation code in the application code to be detected.
S304 determines that last modification account, the last modification account are using the Memory Allocation coded positional information Finally modify the account of every row Memory Allocation code.
In the present solution, the corresponding relationship between code and author is established by the account of written in code person, by interior Deposit the last modification account that distribution coded positional information determines corresponding every row Memory Allocation code, wherein finally modifying account is For the account for finally modifying Memory Allocation code.
Corresponding relationship can be saved by specified data form, be stored in database table for example, by using the mode of key-value pair In, key is location information, is worth for corresponding last modification account.
Corresponding relationship between save location information and last modification account in a static manner is needed in last modification every time When person replaces, corresponding relationship is just updated manually in time, maintenance cost is higher.For this purpose, in a kind of specific embodiment, finally The lookup of modification account can be realized by existing or preset version control system.
Version control system refers to program codes various in software development process, configuration file and illustrates the files such as document Change the system being managed, e.g., CVS (Concurrent Versions System), SVN (Subversion), RCS (Revision Control System), GIT (Georgia Institute of Technology) be Version Control System.Version control system can automatically record and update the location information and its last modification account for the application code write Corresponding relationship between number.
In the case where a kind of possible, sent to version control system for obtaining most using the API of version control system Afterwards modify account request and Memory Allocation coded positional information, and obtain version control system return with Memory Allocation code The corresponding last modification account of location information.
In the present solution, corresponding with Memory Allocation coded positional information to obtain in order to use version control system Account is finally modified, API (application programming interface) Lai Shixian provided using version control system is provided.Different versions Control system can provide different API, be the function that version control system can be used by calling the API of version control system.
It should be noted that version control system can be any version control system, API needs and Version Control system System corresponds to, that is, if it is the API of SVN offer that version control system, which selects SVN, API just to need, if version control system Select GIT, then API just need be GIT provide API.Further, as obtained most using SVN as version control system After modify account, the svn_blame interface of SVN can be called to realize, that is, SVN provide API be svn_blame.
S305, to the corresponding Memory Allocation code bit of each last corresponding Code Edit system transmission of modification account Confidence breath and Memory Allocation code revision instruction, so that the Code Edit system modifies to the Memory Allocation code.
Wherein, each last modification account is corresponding with Code Edit system, and Code Edit system is to be used to edit to answer With the system of program code.
It should be noted that each last modification account is corresponding with Code Edit system, each modification account is corresponding with again Different Memory Allocation coded positional informations, this step need to close according to last modification account is corresponding with Code Edit system System, and the corresponding relationship of last modification account and Memory Allocation coded positional information, determine Memory Allocation coded positional information With the corresponding relationship of Code Edit system, and to Code Edit system send corresponding Memory Allocation coded positional information with Memory Allocation code revision instruction.
It is a kind of may in the case where, can preset last modification account and Code Edit system the communication information it Between corresponding relationship, to Code Edit system send Memory Allocation coded positional information and Memory Allocation code revision instruction When, the communication information of Code Edit system is determined by the last corresponding relationship, and pass through the communication information and Code Edit system Communication connection is established, the transmission of Memory Allocation coded positional information and Memory Allocation code revision instruction is completed.Wherein, communication letter Breath for example can be IP address.
It is a kind of may in the case where, using the API of preset task dissemination system to each last modification account pair The Code Edit system answered sends Memory Allocation code revision instruction and corresponding Memory Allocation coded positional information.
Wherein, task dissemination system is in software development process, for managing each User Exploitation task dispatching information System can distribute corresponding task notifications by task dissemination system from trend custom system.Task dissemination system Selection is in this programme and is not specifically limited, for example, can be TAPD (Tencent Agile Product Development, Tencent's Agile Products research/development platform).
Task dissemination system uses TAPD, can be realized by the add_sub_story interface of TAPD system to last modification The Code Edit system of account sends requirement report, and requirement report includes Memory Allocation code revision instruction and corresponding Memory Allocation generation Code position information.It should be noted that being managed for convenience to the requirement report of same last modification account, can will correspond to same All Memory Allocation code revisions of one last modification account are instructed with corresponding Memory Allocation coded positional information as same Requirement report is issued.
It is the function that task dissemination system can be used by calling the API of task dissemination system, so that calling can be passed through The mode of API is instructed by task dissemination system to send corresponding Memory Allocation code revision to each Code Edit system With Memory Allocation coded positional information, no longer need to safeguard pair between last modification account and the communication information of Code Edit system It should be related to, keep instruction more quick and easy with the transmission of location information.
It should be noted that task dissemination system and version control system are similarly, task dissemination system is also possible to any Kind version control system, API need corresponding with task dissemination system.
The embodiment of the present application can be by determining the last modification account of Memory Allocation code, and modifies account according to last Code revision instruction and Memory Allocation coded positional information are sent to corresponding system, so that corresponding reviser be made to repair in time Change Memory Allocation code, Memory Allocation code is avoided to impact the operation of application program.
Fig. 6 is referred to, it illustrates a kind of Memory Allocation code detections of the application it illustrates a kind of Memory Allocation code The flow diagram of the another embodiment of method, the method for the present embodiment may include:
S401, obtains intermediate language code to be detected, and the intermediate language code to be detected is to application program to be detected The intermediate language code that code is compiled.
S402, determine instruction code is the target intermediate language generation of target instruction target word code in the intermediate language code to be detected Code;The target instruction target word code is the instruction code of corresponding Memory Allocation code.
S403 determines Memory Allocation coded positional information, the Memory Allocation generation using the target intermediate language code Code position information is location information of the Memory Allocation code in the application code to be detected.
S404, judges whether the item number of the target intermediate language code is greater than preset threshold.If so, S405 is executed, if It is no, without operation.
In the case where a kind of possible, can flexibly set each application program to be detected allows Memory Allocation operation occur Maximum times, wherein preset threshold in S404 shows that for application code to be detected, what be can have is interior Deposit the maximum times value of batch operation.If the item number of target intermediate language code is greater than preset threshold, then it represents that be detected to answer With the Memory Allocation size of code in program code exceed the upper limit, need to make modification, then continue to execute S405, otherwise do not need by Modification, stops operation.
S405 determines that last modification account, the last modification account are using the Memory Allocation coded positional information Finally modify the account of every row Memory Allocation code.
S406, to the corresponding Memory Allocation code bit of each last corresponding Code Edit system transmission of modification account Confidence breath and Memory Allocation code revision instruction, so that the Code Edit system modifies to the Memory Allocation code.
S407 receives the modification that the Code Edit system is sent and completes instruction;Execute the S401.
It is a kind of may in the case where, can by way of iteration, be automatically performed the modification to Memory Allocation code with Detection.That is, executing S401 after instruction is completed in the modification for receiving the transmission of Code Edit system, journey is applied to be detected again The intermediate language code of sequence code is detected, and is repeated the above steps, until the item number of target intermediate language code is less than or waits In preset threshold.
The embodiment of the present application is automatically performed detection and modification to Memory Allocation code by way of iteration, makes memory point With code detection, the process of modification it is simpler, conveniently.
In order to make it easy to understand, referring to FIG. 7, a kind of application scenarios in conjunction with this programme are introduced.
First computer equipment is the computer equipment that the embodiment of the present application is used to execute Memory Allocation code detection operation, Second computer equipment is to run the computer equipment of Code Edit system.
Second computer equipment generates application code to be detected, application program generation to be detected by Code Edit system Code is specially based on unity engine and to utilize the game identification code of C# language exploitation.
The relevant information of game identification code is uploaded to SVN system by network by second computer equipment, and relevant information is with SVN The management rule of system determines, needs for example, can specifically include account information, game identification code etc. by the letter of SVN system administration Breath.In the present embodiment, account information is specially user.
First computer equipment obtains the corresponding dll file of game identification code, and the dll file can be obtained from SVN system, The dll file can be obtained from second computer equipment.
First computer equipment is compiled dll file using mono.cecil tool, obtains corresponding with game identification code Intermediate language code to be detected.
First computer equipment determines target instruction target word code, including box, newarr, newobj, by every row intermediate language to be detected Speech code is matched with target instruction target word code respectively, determines the target instruction target word code matched.
For example, game identification code are as follows:
Unitiy.EventSystem.Publish(“ui_camera_mode”,”ui”, shezhiController.Instan ce.IsGame3DCamera)
Presentation mode after being compiled in intermediate language code to be detected are as follows:
box[mscorlib]System.boolean
Wherein box is the instruction code of this journey intermediate language code to be detected, and box is target instruction target word code, it is determined that " box [mscorlib] System.boolean " is target intermediate language code.
First computer equipment determines that every row target intermediate language code is being swum by symbol file corresponding with dll file Actual position information in play code, that is, Memory Allocation coded positional information, the location information include function name and line number.
The API that first computer equipment is provided by SVN, i.e. svn_blame interface find corresponding each Memory Allocation generation The last modification account of code position information in the present embodiment, finally modifies account by taking user as an example.
The API that first computer equipment is provided by TAPD, i.e. add_sub_story are compiled to the code that account is user The system of collecting sends Memory Allocation code revision instruction and corresponding Memory Allocation coded positional information.
Account be user Code Edit system (namely second computer equipment) complete modification after, according to above-mentioned steps to SVN system uploads the relevant information of updated game identification code, and sends modification to the first computer equipment and complete to instruct, and first Computer equipment continues to carry out Memory Allocation code detection operation to updated game identification code, and concrete operations may refer to above-mentioned Step repeats no more.
The Memory Allocation code in game identification code is detected using intermediate language code, without by game running, then it is exhaustive Various operations, so that it may determine the Memory Allocation code in game identification code, and can determine Memory Allocation generation by SVN system The corresponding last modification account of code, using TAPD can account be corresponding issues Memory Allocation code revision automatically for last modification Instruction and Memory Allocation coded positional information can be accomplished the quantity of Memory Allocation code by continuous iterative cycles It minimizes, reduces influence of the Memory Allocation operation to game running effect.
On the other hand, present invention also provides a kind of Memory Allocation code detection systems.Referring to Fig. 8, the embodiment of the present application A kind of Memory Allocation code detection system provided, comprising:
Intermediate language code to be detected obtains module 501, for obtaining intermediate language code to be detected;It is described it is to be detected in Between language codes be the intermediate language code being compiled to application code to be detected;
Target intermediate language code determining module 502, for the determine instruction code in the intermediate language code to be detected For the target intermediate language code of target instruction target word code;The target instruction target word code is the instruction code of corresponding Memory Allocation code;
Location information determining module 503, for determining Memory Allocation code position using the target intermediate language code Information, the Memory Allocation coded positional information are position letter of the Memory Allocation code in the application code to be detected Breath.
Optionally, the location information determining module 503 includes:
Target intermediate language code determination unit includes Memory Allocation for determining in the target intermediate language code The target intermediate language code of instruction;
Memory Allocation coded positional information determination unit, for utilizing language among the target including Memory Allocation instruction Speech code determines Memory Allocation coded positional information.
Optionally, the system further include:
Account determining module is finally modified, for determining last modification account using the Memory Allocation coded positional information Number, the last modification account is finally to modify the account of every row Memory Allocation code;
Instruction sending module, it is corresponding interior for being sent to the corresponding Code Edit system of each last modification account Distribution coded positional information and Memory Allocation code revision instruction are deposited, so that the Code Edit system is to the Memory Allocation generation Code is modified.
Optionally, the system further include:
Judgment module, for judging whether the item number of the target intermediate language code is greater than preset threshold;If so, calling The intermediate language code to be detected obtains module 501.
Optionally, the system further include:
Command reception module completes instruction for receiving the modification that the Code Edit system is sent.
Optionally, finally modification account determining module includes:
Request transmitting unit is sent to the version control system for obtaining for the API using version control system Finally modify request and the Memory Allocation coded positional information of account;
Account acquiring unit is finally modified, for obtaining that the version control system returns and Memory Allocation code position The corresponding last modification account of information.
Optionally, instruction sending module is specifically used for described finally repairing using the API of preset task dissemination system to each Change the corresponding Code Edit system of account and sends Memory Allocation code revision instruction and corresponding Memory Allocation coded positional information.
Optionally, location information determining module 503 is specifically used for determining memory point using the target intermediate language code Line number and affiliated function name with code in the application code to be detected.
Optionally, the target instruction target word code includes:
Box instructs corresponding instruction code, newarr that corresponding instruction code and newobj is instructed to instruct corresponding instruction code.
Further, the embodiment of the present application also provides a kind of computer equipments.Fig. 9 shows a kind of memory of the application point The computer equipment schematic diagram being applicable in code detection method.
As shown in Figure 9, which may include: processor 11, memory 12, communication interface 13, input list Member 14 and display 15 and communication bus 16.
Processor 11, communication interface 13, input unit 14, display 15, is completed by communication bus 16 memory 12 Mutual communication.
In the embodiment of the present application, the processor 11, can for central processing unit (Central Processing Unit, CPU), application-specific integrated circuit, digital signal processor, ready-made programmable gate array or other programmable logic device Deng.The processor can call the program stored in memory 12.Specifically, processor can execute following Memory Allocation code Operation performed by computer equipment side in the embodiment of detection method.
For storing one or more than one program in memory 12, program may include program code, program code Including computer operation instruction, in the embodiment of the present application, at least it is stored in the memory for realizing any of the above memory Distribute the program of code detection method.
In one possible implementation, which may include storing program area and storage data area, wherein deposit Storing up program area can be needed for storage program area and at least one function (such as to function that application code is compiled) Application program etc.;Storage data area can store the data created in the use process according to computer, for example, to be detected answer With at code, intermediate language code, Memory Allocation coded positional information etc..
In addition, memory 12 also may include high-speed random access memory, it can also include nonvolatile memory, example Such as at least one disk memory or other volatile solid-state parts.
The communication interface 13 can be the interface of communication module, such as the interface of gsm module.
The application can also include display 14 and input unit 15 etc..
Certainly, the structure of computer equipment shown in Fig. 9 does not constitute the limit to computer equipment in the embodiment of the present application Fixed, computer equipment may include than more or fewer components shown in FIG. 1, or the certain portions of combination in practical applications Part.
Wherein, the computer equipment 10 in Fig. 9 can be terminal (such as PC machine), or performance is higher than ordinary terminal Server.
In the embodiment of the present application, computer equipment 10 can receive extraneous other using network according to communication interface 13 and set The application code to be detected that preparation is sent;Can also by itself input unit 14 (such as keyboard, touch screen, voice input Equipment etc.) obtain application code to be detected.
Correspondingly, processor 11 can be single from communication interface 13 or input by communication bus 16 in computer equipment 10 Member 14 receives application code to be detected, and the program stored in memory 12 is called to carry out application code to be detected Compiling, and the intermediate code obtained to compiling detects, to determine the location information of Memory Allocation code, to realize conveniently The purpose that all Memory Allocation codes are detected in application code.
On the other hand, present invention also provides a kind of storage medium, it is stored with computer program in the storage medium, it is described When computer program is loaded and executed by processor, for realizing Memory Allocation generation described in any one embodiment as above Code detection method.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For device class embodiment, since it is basically similar to the method embodiment, so being described relatively simple, related place ginseng See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged Except there is also other identical elements in the process, method, article or equipment for including element.
The foregoing description of the disclosed embodiments can be realized those skilled in the art or using the present invention.To this A variety of modifications of a little embodiments will be apparent for a person skilled in the art, and the general principles defined herein can Without departing from the spirit or scope of the present invention, to realize in other embodiments.Therefore, the present invention will not be limited It is formed on the embodiments shown herein, and is to fit to consistent with the principles and novel features disclosed in this article widest Range.
The above is only the preferred embodiment of the present invention, it is noted that those skilled in the art are come It says, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications also should be regarded as Protection scope of the present invention.

Claims (10)

1. a kind of Memory Allocation code detection method characterized by comprising
Intermediate language code to be detected is obtained, the intermediate language code to be detected is to compile to application code to be detected The intermediate language code translated;
Determine instruction code is the target intermediate language code of target instruction target word code in the intermediate language code to be detected;The mesh Mark instruction code is the instruction code of corresponding Memory Allocation code;
Memory Allocation coded positional information, the Memory Allocation coded positional information are determined using the target intermediate language code For location information of the Memory Allocation code in the application code to be detected.
2. the method according to claim 1, wherein described determine memory using the target intermediate language code Distribute coded positional information, comprising:
The target intermediate language code including Memory Allocation instruction is determined in the target intermediate language code;
Memory Allocation coded positional information is determined using the target intermediate language code including Memory Allocation instruction.
3. the method according to claim 1, wherein described determine memory using the target intermediate language code It distributes after coded positional information, further includes:
Determine that last modification account, the last modification account are that last modification is every using the Memory Allocation coded positional information The account of row Memory Allocation code;
To the corresponding Code Edit system of each last modification account send corresponding Memory Allocation coded positional information and Memory Allocation code revision instruction, so that the Code Edit system modifies to the Memory Allocation code.
4. according to the method described in claim 3, it is characterized in that, described determined using the Memory Allocation coded positional information Finally before modification account, further includes:
Judge whether the item number of the target intermediate language code is greater than preset threshold;
If so, executing described the step of determining last modification account using the Memory Allocation coded positional information.
5. according to the method described in claim 4, it is characterized in that, described to the corresponding code of each last modification account Editing system send Memory Allocation code revision instruction with after corresponding Memory Allocation coded positional information, further includes:
It receives the modification that the Code Edit system is sent and completes instruction;Execute the step for obtaining intermediate language code to be detected Suddenly.
6. according to the method described in claim 3, it is characterized in that, described determined using the Memory Allocation coded positional information Finally modify the last modification account of every row Memory Allocation code, comprising:
Request for obtaining last modification account and interior is sent to the version control system using the API of version control system Deposit distribution coded positional information;
Obtain the last modification account corresponding with Memory Allocation coded positional information that the version control system returns.
7. according to claim 1 to method described in 6 any one, which is characterized in that the target instruction target word code includes:
Box instructs corresponding instruction code, newarr that corresponding instruction code and newobj is instructed to instruct corresponding instruction code.
8. a kind of Memory Allocation code detection system characterized by comprising
Intermediate language code to be detected obtains module, for obtaining intermediate language code to be detected;The intermediate language to be detected Code is the intermediate language code being compiled to application code to be detected;
Target intermediate language code determining module, in the intermediate language code to be detected determine instruction code refer to for target Enable the target intermediate language code of code;The target instruction target word code is the instruction code of corresponding Memory Allocation code;
Location information determining module, for determining Memory Allocation coded positional information, institute using the target intermediate language code Stating Memory Allocation coded positional information is location information of the Memory Allocation code in the application code to be detected.
9. a kind of computer equipment characterized by comprising
Processor and memory;
Wherein, the processor is for executing the program stored in the memory;
For storing program, described program is at least used for the memory:
Obtain intermediate language code to be detected;Wherein, the intermediate language code to be detected is to application code to be detected The intermediate language code being compiled;
Determine instruction code is the target intermediate language code of target instruction target word code in the intermediate language code to be detected;Wherein, The target instruction target word code is the instruction code of corresponding Memory Allocation code;
Memory Allocation coded positional information, the Memory Allocation coded positional information are determined using the target intermediate language code For location information of the Memory Allocation code in the application code to be detected.
10. a kind of storage medium, which is characterized in that be stored with computer executable instructions, the calculating in the storage medium When machine executable instruction is loaded and executed by processor, the described in any item Memory Allocation codes of claim 1 to 7 as above are realized Detection method.
CN201910642148.8A 2019-07-16 2019-07-16 Memory allocation code detection method and device, computer equipment and storage medium Active CN110334031B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910642148.8A CN110334031B (en) 2019-07-16 2019-07-16 Memory allocation code detection method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910642148.8A CN110334031B (en) 2019-07-16 2019-07-16 Memory allocation code detection method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110334031A true CN110334031A (en) 2019-10-15
CN110334031B CN110334031B (en) 2023-11-03

Family

ID=68145517

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910642148.8A Active CN110334031B (en) 2019-07-16 2019-07-16 Memory allocation code detection method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110334031B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111338864A (en) * 2020-02-18 2020-06-26 上海闻泰电子科技有限公司 Memory problem detection method and device, computer equipment and storage medium
CN113220554A (en) * 2021-05-17 2021-08-06 北京百度网讯科技有限公司 Method and apparatus for detecting performance of program code

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123218A (en) * 2013-04-23 2014-10-29 腾讯科技(深圳)有限公司 Method, device and system for code coverage test
WO2017035748A1 (en) * 2015-08-31 2017-03-09 华为技术有限公司 Code compiling method and code complier
CN109344051A (en) * 2018-08-28 2019-02-15 北京达佳互联信息技术有限公司 Method, apparatus, electronic equipment and the storage medium of data processing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123218A (en) * 2013-04-23 2014-10-29 腾讯科技(深圳)有限公司 Method, device and system for code coverage test
WO2017035748A1 (en) * 2015-08-31 2017-03-09 华为技术有限公司 Code compiling method and code complier
CN109344051A (en) * 2018-08-28 2019-02-15 北京达佳互联信息技术有限公司 Method, apparatus, electronic equipment and the storage medium of data processing

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
R. FINLAYSON;LIVE.COM;: "An Abstract API for Multicast Address Allocation", IETF RFC2771 *
孙雷;: "安全协议多目标语言代码缺陷检测方法仿真", 计算机仿真, no. 12 *
高海昌;冯博琴;何杭军;朱利;: "Linux平台下基于源代码插装的动态内存检测", 小型微型计算机系统, no. 09 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111338864A (en) * 2020-02-18 2020-06-26 上海闻泰电子科技有限公司 Memory problem detection method and device, computer equipment and storage medium
CN111338864B (en) * 2020-02-18 2023-08-18 上海闻泰电子科技有限公司 Memory problem detection method, device, computer equipment and storage medium
CN113220554A (en) * 2021-05-17 2021-08-06 北京百度网讯科技有限公司 Method and apparatus for detecting performance of program code
CN113220554B (en) * 2021-05-17 2023-07-25 北京百度网讯科技有限公司 Method and apparatus for detecting performance of program code

Also Published As

Publication number Publication date
CN110334031B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
US11789715B2 (en) Systems and methods for transformation of reporting schema
US10481884B2 (en) Systems and methods for dynamically replacing code objects for code pushdown
US20240045850A1 (en) Systems and methods for database orientation transformation
US20230244465A1 (en) Systems and methods for automated retrofitting of customized code objects
US8706771B2 (en) Systems and methods for analyzing and transforming an application from a source installation to a target installation
US20130219307A1 (en) System and method for runtime user interface management
US20080120598A1 (en) Method and apparatus of a build management system
US11667033B2 (en) Systems and methods for robotic process automation
CN113885870B (en) Application program updating method, electronic equipment, terminal equipment and system
CN112149109B (en) Modularized authority control management method and system
CN109408354B (en) Data processing method and device for application component
CN112506492A (en) Visual point burying method supporting dynamic scene configuration
CN110334031A (en) Memory Allocation code detection method, device, computer equipment and storage medium
CN107943504A (en) The dynamic update method of software module in a kind of embedded system
US10606569B2 (en) Declarative configuration elements
CN114461223A (en) Code generation method and device and terminal equipment
KR20130020135A (en) System and method of providing the developer list of developing code simultaneously in an integrated development environment
CN114356783A (en) Method and device for automatically generating unit test code, storage medium and equipment
CN111026466A (en) File processing method and device, computer readable storage medium and electronic equipment
US20240338185A1 (en) Automatic runtime execution hardening through static system application programming interface (api) data mapping
TWI667613B (en) Front-end integration development management system and method thereof
CN115857962A (en) Software project processing method and device, electronic equipment and readable storage medium
CN114691096A (en) Intelligent contract development method, device, equipment and storage medium
CN118192946A (en) Cross-platform multi-module software construction method and device, electronic equipment and storage medium
CN115756763A (en) Method, device and system for quickly compiling and operating micro-service container and electronic equipment

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