[go: up one dir, main page]

CN108196937A - Processing method, device, computer equipment and the storage medium of string - Google Patents

Processing method, device, computer equipment and the storage medium of string Download PDF

Info

Publication number
CN108196937A
CN108196937A CN201711433445.9A CN201711433445A CN108196937A CN 108196937 A CN108196937 A CN 108196937A CN 201711433445 A CN201711433445 A CN 201711433445A CN 108196937 A CN108196937 A CN 108196937A
Authority
CN
China
Prior art keywords
memory
string
character string
jvm
host
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
CN201711433445.9A
Other languages
Chinese (zh)
Other versions
CN108196937B (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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China 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 Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201711433445.9A priority Critical patent/CN108196937B/en
Publication of CN108196937A publication Critical patent/CN108196937A/en
Application granted granted Critical
Publication of CN108196937B publication Critical patent/CN108196937B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

This application involves a kind of processing method of string, device, computer equipment and storage mediums.The method includes:Obtain character string information and the corresponding memory application information that java applet includes;Character string information is converted, obtains character string;Using character string and memory application information generation string request to create, string request to create is sent to host, host is made to distribute corresponding out-pile memory for character string from operating system memory according to memory application information;It is stored character string as string to out-pile memory.Heap memory can be reduced using this method to occupy.

Description

Processing method, device, computer equipment and the storage medium of string
Technical field
This application involves field of computer technology, more particularly to a kind of processing method of string, device, calculating Machine equipment and storage medium.
Background technology
At present, Java language (a kind of Object-Oriented Programming Language) is widely used in realization different application, as ERP is applied Program (Enterprise Resource Planning enterprise resource plannings).Based on Java language application program (with Lower abbreviation " java applet ") it needs to run in JVM (Java Virtual Machine, Java Virtual Machine).Work as java applet During startup, the operating system of computer equipment gives JVM storage allocations (hereinafter referred to as from operating system memory where java applet " JVM memories ").JVM memories include heap memory and other memories, and wherein heap memory is one piece of memory maximum in JVM memories.When When java applet is run in JVM, java applet creates the string of needs in JVM memories.
The String classes that traditional approach can only use the Software Development Kit (JDK) of Java language to provide create character string Object.But according to the memory management mechanism of JDK, the string that the String classes provided using JDK are created can only be stored in In the heap memory of JVM, since heap memory is limited so that when java applet needs a large amount of strings, easily occur OOM (Out of memory, memory overflow).The occupancy of a large amount of heap memories also results in Full GC (Full Garbage Collection, excess load garbage reclamation) so that the phenomenon that Java processes stop servicing, causing java applet interim card.
Invention content
Based on this, it is necessary to for above-mentioned technical problem, provide a kind of string that can reduce heap memory occupancy Processing method, device, computer equipment and storage medium.
A kind of processing method of string, the method includes:
Obtain character string information and the corresponding memory application information that java applet includes;
The character string information is converted, obtains character string;
Using the character string and memory application information generation string request to create, by the character string Object Creation request is sent to host, and the host is made according to the memory application information to be described from operating system memory Character string distributes corresponding out-pile memory;
It is stored the character string as string to the out-pile memory.
Obtaining character string information and the corresponding memory letter of application that java applet includes in one of the embodiments, Before the step of breath, further include:When the java applet starts, java applet operation request is sent to the host, is obtained The JVM memories that the host is taken to be distributed according to java applet operation request from the operating system memory;The operating system Memory includes the JVM memories and target memory;The JVM memories include heap memory and direct memory;Bag deposit in the out-pile Include at least one of the target memory or the direct memory.
The step of converting to the character string information in one of the embodiments, obtain character string, including: Deconsolidation process is carried out to the character string information, obtains the character string.
The memory application information includes the target memory access letter based on first interface in one of the embodiments, Breath;The step of using the character string and memory application information generation string request to create, including:Obtain institute Character string information is stated, calculates corresponding memory headroom;Whether the size for comparing the memory headroom reaches threshold value;When the memory When the size in space reaches threshold value, generated using the character string and the target memory access information based on first interface String request to create.
The memory application information includes the direct memory access letter based on second interface in one of the embodiments, Breath;The step of using the character string and memory application information generation string request to create, including:Obtain institute Character string information is stated, calculates corresponding memory headroom;Whether the size for comparing the memory headroom reaches threshold value;When the memory When the size in space is not up to threshold value, given birth to using the character string and the direct memory access information based on second interface Into string request to create.
The method further includes in one of the embodiments,:String quote request is sent to the host, The string quote request carries the memory address index and character length of the character string, makes the host The corresponding character string is read in the out-pile memory according to memory address index and character length;The character Sequence includes multiple characters;Multiple characters that the host returns are received, by the way that multiple characters are spliced, by the word Symbol sequence is converted to string.
The method further includes in one of the embodiments,:Whether the string is detected according to predeterminated frequency It is cited;When the string is unreferenced, corresponding string is discharged from the out-pile memory, The out-pile memory is recycled.
A kind of processing unit of string, described device include:It host and operates on the host JVM virtual machines;When java applet is run, the JVM virtual machines are used to obtain the character string information that the java applet includes And corresponding memory application information, the character string information is converted, obtains character string, utilizes the character string String request to create is generated with the memory application information, the string request to create is sent to host Machine;The host is used to distribute corresponding heap for the character string from operating system memory according to the memory application information Outer memory;The JVM virtual machines are additionally operable to store the character string as string to the out-pile memory.
In one of the embodiments, when the java applet starts, the JVM virtual machines are additionally operable to the host Machine sends java applet operation request;The host is additionally operable to be asked from the operating system according to java applet operation Memory distributes JVM memories to the JVM virtual machines;The JVM virtual machines are additionally operable to run the Java in the JVM memories Program;The operating system memory includes the JVM memories and target memory;The JVM memories are interior including heap memory and directly It deposits;The out-pile memory includes at least one of the target memory or the direct memory.
The JVM virtual machines are additionally operable to carry out deconsolidation process to the character string information in one of the embodiments, obtain To the character string.
The memory application information includes the target memory access letter based on first interface in one of the embodiments, Breath;The JVM virtual machines are additionally operable to obtain the character string information, calculate corresponding memory headroom, the memory headroom Size whether reach threshold value, when the size of the memory headroom reaches threshold value, using the character string and described be based on The target memory access information generation string request to create of first interface.
The memory application information includes the direct memory access letter based on second interface in one of the embodiments, Breath;The JVM virtual machines are additionally operable to obtain the character string information, calculate corresponding memory headroom, the memory headroom Size whether reach threshold value, when the size of the memory headroom is not up to threshold value, utilize the character string and the base String request to create is generated in the direct memory access information of second interface.
In one of the embodiments, when needing reference character string object, the JVM virtual machines are additionally operable to the place Host sends string quote request, and the string quote request carries the memory address of the character string Index and character length;The host is additionally operable to according to memory address index and character length in the out-pile memory The corresponding character string is read, the character string includes multiple characters, it is virtual that multiple characters are back to the JVM Machine;The JVM virtual machines are additionally operable to, by the way that multiple characters are spliced, the character string is converted to string.
The JVM virtual machines are additionally operable to detect the string according to predeterminated frequency in one of the embodiments, Whether it is cited;When the string is unreferenced, corresponding string is carried out from the out-pile memory Release, recycles the out-pile memory.
A kind of computer equipment can be run on a memory and on a processor including memory, processor and storage The step of computer program, the processor realizes any of the above-described method when performing the computer program.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor The step of any of the above-described method is realized during row.
Processing method, device, computer equipment and the storage medium of above-mentioned string, by java applet Character string information is converted, and can character string be converted to character string;Utilize the character string and Java being converted to Memory application information in program, can to host application out-pile memory, created in out-pile memory so as to realizing and Store string.Character string is converted to the character string of non-character string, and is accessed according to specific memory application information The out-pile memory of host can break through the memory management that JDK can only be created and be stored in heap memory about string Mechanism freely creates and stores string, and then can reduce heap memory using the operating system memory of host Occupancy, reduce the generation of GC and OOM, improve the stability and fluency of java applet.
Description of the drawings
Fig. 1 is the application scenario diagram of the processing method of string in one embodiment;
Fig. 2 is the flow diagram of the processing method of string in one embodiment;
Fig. 3 is the internal structure chart of one embodiment Computer equipment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the object, technical solution and advantage for making the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
The string that the application provides creates and storage method, can be applied in application environment as shown in Figure 1. Wherein, JVM virtual machines 104 have been run on host 102.Java applet is deployed in JVM virtual machines 104.When java applet opens When dynamic, JVM virtual machines 104 send java applet operation request to host 102, and the operating system of host 102 is according to Java Program execution request distributes JVM memories from operating system memory for JVM virtual machines 104.Operating system memory refers to host Total memory of program and data when in 102 for preserving process operation includes the memory space of " memory bar " memory.Operation system Memory of uniting includes JVM memories and target memory.Wherein, JVM memories refer to the special memory of JVM virtual machines 104.Target memory is Refer to other memories in addition to JVM memories in operating system memory.JVM memories include heap memory and direct memory.
The present embodiment provides one kind can create and store string (hereinafter referred to as " Str objects ") in out-pile memory Target interface.When the string of establishment needs to occupy the memory space of a large amount of heap memories, can select in Java journeys Invocation target interface in sequence creates string, to reduce the occupancy of heap memory using target interface in out-pile memory.When For java applet when being run on host 102, JVM virtual machines 104 load java applet, obtain the character string that java applet includes Information.Character string information includes the content of one or more character strings.If java applet has invoked target interface, java applet In be also recorded for the corresponding memory application information of character string information.Memory application information includes the target memory based on first interface Access information or the direct memory access information based on second interface.Wherein, first interface can be a kind of Unsafe interfaces (use In the interface of access target memory), second interface can be Java NIO interfaces (a kind of interface for being used to access direct memory). JVM virtual machines 104 obtain memory application information in java applet.JVM virtual machines 104 are using target interface to character string information Deconsolidation process is carried out, obtains character string.JVM virtual machines 104 utilize character string and memory application information generation character string pair As request to create, string request to create is sent to host 102.Host 104 is according to memory application information from behaviour Make Installed System Memory and distribute corresponding out-pile memory for character string.Out-pile memory can be target memory or directly in It deposits.Character string is encapsulated as string by JVM virtual machines 104, and string is stored in the out-pile obtained to distribution In depositing.Above-mentioned string creates process, by the way that character string is converted to character string, and passes through first interface or second Interface can store character string to out-pile memory, to host application out-pile memory so as to reduce the occupancy of heap memory.
In one embodiment, as shown in Fig. 2, providing a kind of string establishment and storage method, in this way It illustrates, includes the following steps applied to the JVM virtual machine instances in Fig. 1:
Step 202, character string information and the corresponding memory application information that java applet includes are obtained.
Java applet can be the arbitrary application program based on Java language.
In one embodiment, the character string information that includes of java applet and corresponding memory application information are being obtained Before step, further include:When java applet starts, to host send java applet operation request, obtain host according to The JVM memories that java applet operation request is distributed from operating system memory;Operating system memory is included in JVM memories and target It deposits;JVM memories include heap memory and direct memory;Out-pile memory includes at least one of target memory or direct memory.
When java applet starts, JVM virtual machines send java applet operation request, the operation system of host to host System runs according to java applet and asks, and JVM memories are distributed from operating system memory for JVM virtual machines.Operating system memory refers to Total memory of program and data when in host for preserving process operation includes the memory space of " memory bar " memory. In another embodiment, operating system memory further includes exented memory, such as virtual memory.Operating system memory includes JVM memories And target memory.Wherein, JVM memories refer to the special memory of JVM virtual machines.Target memory refers to remove JVM in operating system memory Other memories except memory.JVM memories include heap memory and direct memory.It is readily appreciated that, exented memory belongs to target memory.
Traditional memory management mechanism based on JDK, the String class functions that JVM virtual machines can only use JDK to provide exist String (hereinafter referred to as " String objects ") is created and stored in heap memory.For example, String str=" hello world”.It is readily appreciated that, String objects can occupy limited heap memory so that need a large amount of strings in java applet GC or OOM occurs for Shi Rongyi so that the phenomenon that Java processes stop servicing, causing java applet interim card.Although java applet can To avoid the generation of OOM in several ways, big task is such as split as multiple small tasks carryings, avoids disposable application too Big heap memory space, but this is not only difficult to evade OOM from root, and can increase the program code complexity of java applet.
To solve the above-mentioned problems, the present embodiment provides one kind can create and store string in out-pile memory Target interface.In order to be distinguished with traditional String objects created in heap memory, will be created in out-pile memory String be denoted as Str objects.Out-pile memory includes at least one of target memory or direct memory.When the word of establishment When symbol string object needs to occupy the memory space of a large amount of heap memories, the invocation target interface in java applet can be selected, is utilized Target interface creates string in out-pile memory, to reduce the occupancy of heap memory.
The program code of java applet contains information (hereinafter referred to as " the character string letter for the string for needing to create Breath ").Character string information includes at least one String character strings or char arrays (character array), in the example above String character strings " Hello world!”.JVM virtual machine load and execution java applets obtain the character string that java applet includes Information.If java applet has invoked above-mentioned target interface, the program code of java applet further comprises character string information correspondence Memory application information.Memory application information is including the target memory access information based on first interface or based on second interface Direct memory access information.
Step 204, character string information is converted, obtains character string.
Character string information is converted to character string (CharSequence) by JVM virtual machines using target interface.
In one embodiment, the step of being converted to character string information, obtaining character string, including:To character string Information carries out deconsolidation process, obtains character string.
Target interface includes character and converts script.When character string information includes char arrays, JVM virtual machines utilize character It converts script and deconsolidation process is carried out to char arrays, obtain character string.Character string includes multiple characters.Work as character string information During including String character strings, String character strings are converted to char arrays by JVM virtual machines using character conversion script, according to Aforesaid way carries out deconsolidation process to the char arrays being converted to, and obtains character string.
By memory application information for for the target memory access information based on first interface, corresponding character converts script The program code of record can be as shown in table 1:
Table 1
Character string (String character strings or char arrays) can be converted to non-character by JVM virtual machines using target interface It goes here and there (character string), is limited so as to the memory management mechanism not by JDK, it can be in the operating system memory of host Freely apply for memory.
Step 206, string request to create is generated using character string and memory application information, by string Request to create is sent to host, makes host corresponding for character string distribution from operating system memory according to memory application information Out-pile memory.
Step 208, it is stored character string as string to out-pile memory.
JVM virtual machines are given birth to using the character string being converted to and the memory application information got in java applet Into string request to create, string request to create is sent to host.When memory application information is based on the During the target memory access information of one interface, JVM virtual machines are by first interface to host application target memory.Wherein, One interface can be Unsafe interfaces.When memory application information is the direct memory access information based on second interface, JVM is empty Plan machine is by second interface to the direct memory of host application.Wherein, second interface can be Java NIO interfaces.Character string pair As request to create carries the sequence length information of character string and the corresponding memory space for needing to apply.Host according to Sequence length information and memory application information distribute the target memory in respective stored space from operating system memory for character string Or direct memory.
Target interface further includes character encapsulation script.Character string is encapsulated as by JVM virtual machines using character encapsulation script Str objects.Character encapsulation script can be as shown in table 2:
Table 2
Str objects are stored the target memory distributed to host or direct memory by JVM virtual machines.Host completes Str After the storage of object, the memory address that Str objects are returned to JVM virtual machines indexes.
In the present embodiment, by being converted to the character string information in java applet, character string can be converted to word Accord with sequence;It, can be to host application heap using the memory application information in the character string and java applet being converted to Outer memory in out-pile memory creates and stores string so as to realize.Character string is converted into non-character string Character string, and according to the out-pile memory of specific memory application information access host, JDK can be broken through about character string pair As the memory management mechanism that can only be created and store in heap memory, freely created using the operating system memory of host With storage string, and then the occupancy of heap memory can be reduced, reduce the generation of GC and OOM, improve the steady of java applet Qualitative and fluency.
In one embodiment, memory application information includes the target memory access information based on first interface;Utilize word The step of according with sequence and memory application information generation string request to create, including:Character string information is obtained, calculates and corresponds to Memory headroom;Whether the size for comparing memory headroom reaches threshold value;When the size of memory headroom reaches threshold value, character sequence is utilized Row and the target memory access information generation string request to create based on first interface;When the size of memory headroom does not reach During to threshold value, string request to create is generated using character string and the direct memory access information based on second interface.
JVM virtual machines can utilize start-up parameter MaxDirectMemorySize depositing to the direct memory that can apply Storage space upper limit value is configured.If not being configured, the memory space upper limit value for the direct memory that can apply is set as silent Recognize value.Since the memory space of direct memory that can apply is conditional, JVM virtual machines can be believed by calculating character string Breath needs the size of memory headroom applied, according to the size to memory headroom whether reach the judging result of threshold value select to Host application target memory or direct memory.Wherein, threshold value can be depositing according to the above-mentioned direct memory that can apply Store up the setting of space upper limit value.
When judging result reaches threshold value for the size of memory headroom, JVM virtual machines are using character string and based on first The target memory access information generation string request to create of interface, host is sent to by string request to create Machine, i.e. JVM virtual machines access the target memory on host by first interface, and to host application target memory.Wherein, First interface can be Unsafe interfaces;Target memory access information based on first interface can be as shown in table 3:
Table 3
When judging result is not up to threshold value for the size of memory headroom, JVM virtual machines are using character string and based on the The direct memory access information generation string request to create of two interfaces, host is sent to by string request to create Machine, i.e. JVM virtual machines access the direct memory on host by second interface, and to the direct memory of host application.Wherein, Second interface can be Java NIO interfaces;Direct memory access information based on second interface can be as shown in table 4:
Table 4
It should be noted that in another embodiment, JVM virtual machines can not be limited by above-mentioned threshold value, free Shen It please directly memory or target memory.
In the present embodiment, the memory space of the relatively direct memory of the corresponding memory space of combining target memory it is larger and The memory space for the direct memory that can apply has conditional situation, big according to the memory headroom that character string information needs are applied Whether small be more than that different out-pile memory is applied in threshold value selection, is adapted to the string of different data amount, can be to avoid Because the direct memory that string needs are applied is more than that the remaining direct memory of JVM virtual machines can not successfully create and store word Accord with string object.
In one embodiment, this method further includes:String quote request, string are sent to host Quote request carries the memory address index and character length of character string, makes host according to memory address index and character Length reads corresponding character string in out-pile memory;Character string includes multiple characters;Receive the multiple of host return Character string by the way that multiple characters are spliced, is converted to string by character.
JVM virtual machines calculate the character length of the character string after character string information is converted to character string.Host After machine completes the storage of Str objects, the memory address that Str objects can be returned to JVM virtual machines indexes.JVM virtual machines are to character The memory address index and character length of string object are stored.When needing to quote some string, JVM virtual machines obtain The memory address index and character length of the string are taken, the memory address got index and character length is utilized to generate String quote request is sent to host by string quote request.Host according to memory address index and Character length reads corresponding Str objects in out-pile memory, and Str objects are corresponded to multiple characters that character string includes returns To JVM virtual machines.Multiple characters are spliced into char arrays by JVM virtual machines, and char arrays, which are converted, can obtain storage String objects.Wherein, the information that string quote request carries can be as shown in table 5:
Table 5
It in the present embodiment, stores to out-pile memory though character string information is converted to character string, is somebody's turn to do when needing to quote During character string, answering splicing to character string progress letter can restore to obtain string, in other words, in the processing of out-pile memory String can be quoted directly after simple process is carried out.
In one embodiment, this method further includes:Whether it is cited according to predeterminated frequency detection string;Work as word When symbol string object is unreferenced, corresponding string is discharged from out-pile memory, out-pile memory is recycled.
JVM virtual machines are examined according to predeterminated frequency to whether multiple strings of out-pile memory storage are cited It surveys.When detecting that some string is unreferenced, JVM virtual machines are after the preset lime by the word from out-pile memory Symbol string object is discharged, and out-pile memory is recycled.For example, method Void free () may be used in JVM virtual machines {charSequence.free();Garbage reclamation is carried out to unreferenced string.
In the present embodiment, the reference situation of multiple strings of out-pile memory storage is detected, it can be timely Garbage reclamation is carried out to unreferenced string, reduces the wasting of resources of out-pile memory.
It should be understood that although each step in the flow chart of Fig. 2 is shown successively according to the instruction of arrow, this A little steps are not that the inevitable sequence indicated according to arrow performs successively.Unless expressly state otherwise herein, these steps It performs there is no the limitation of stringent sequence, these steps can perform in other order.Moreover, at least part in Fig. 2 Step can include multiple sub-steps, and either these sub-steps of multiple stages or stage are performed in synchronization It completes, but can perform at different times, the execution sequence in these sub-steps or stage is also not necessarily to be carried out successively, It but can either the sub-step of other steps or at least part in stage perform in turn or alternately with other steps.
In one embodiment, a kind of processing unit of string is provided, including:Host and operate in place JVM virtual machines on host, wherein:When java applet is run, JVM virtual machines are used to obtain the character string that java applet includes Information and corresponding memory application information, convert character string information, obtain character string, utilize character string and interior Application information generation string request to create is deposited, string request to create is sent to host;Host is used for According to memory application information corresponding out-pile memory is distributed for character string from operating system memory;JVM virtual machines be additionally operable to by Character string is stored as string to out-pile memory.
In one embodiment, when java applet starts, JVM virtual machines are additionally operable to send java applet fortune to host Row request;Host is additionally operable to distribute JVM memories to JVM virtual machines from operating system memory according to java applet operation request; JVM virtual machines are additionally operable to run java applet in JVM memories;Operating system memory includes JVM memories and target memory;JVM Memory includes heap memory and direct memory;Out-pile memory includes at least one of target memory or direct memory.
In one embodiment, JVM virtual machines are additionally operable to carry out deconsolidation process to character string information, obtain character string.
In one embodiment, memory application information includes the target memory access information based on first interface;JVM is virtual Machine is additionally operable to obtain character string information, calculates corresponding memory headroom, whether the size for comparing memory headroom reaches threshold value, when interior When depositing the size in space and reaching threshold value, character string and the generation character string of the target memory access information based on first interface are utilized Object Creation is asked.
In one embodiment, memory application information includes the direct memory access information based on second interface;JVM is virtual Machine is additionally operable to obtain character string information, calculates corresponding memory headroom, whether the size for comparing memory headroom reaches threshold value, when interior When depositing the size in space and being not up to threshold value, character string and the generation character of the direct memory access information based on second interface are utilized String object request to create.
In one embodiment, when needing reference character string object, JVM virtual machines are additionally operable to send character to host String object quote request, string quote request carry the memory address index and character length of character string;Host Machine is additionally operable to read corresponding character string in out-pile memory according to memory address index and character length, and character string includes Multiple characters are back to JVM virtual machines by multiple characters;JVM virtual machines are additionally operable to by the way that multiple characters are spliced, by word Symbol sequence is converted to string.
In one embodiment, whether JVM virtual machines are additionally operable to be cited according to predeterminated frequency detection string;When When string is unreferenced, corresponding string is discharged from out-pile memory, out-pile memory is returned It receives.
The specific of processing unit about string limits the processing that may refer to above for string The restriction of method, details are not described herein.In one embodiment, the processing unit for the string that the application provides can be real It is now a kind of form of computer program, computer program can be run on computer equipment as shown in Figure 3.
In one embodiment, a kind of computer equipment is provided, which can be terminal, internal structure Figure can be as shown in Figure 3.The computer equipment includes the processor connected by system bus, memory, network interface, display Screen and input unit.Wherein, the processor of the computer equipment is for offer calculating and control ability.The computer equipment is deposited Reservoir includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, JVM virtual machines And computer program.The built-in storage is operating system, JVM virtual machines and computer program in non-volatile memory medium Operation provides environment.The network interface of the computer equipment is used to communicate by network connection with external terminal.The computer To realize a kind of processing method of string when program is executed by processor.The display screen of the computer equipment can be liquid Crystal display screen or electric ink display screen, the input unit of the computer equipment can be the touch layers covered on display screen, Can also be the button set on computer equipment shell, trace ball or Trackpad, can also be external keyboard, Trackpad or Mouse etc..
It will be understood by those skilled in the art that the structure shown in Fig. 3, only part knot relevant with application scheme The block diagram of structure does not form the restriction for the computer equipment being applied thereon to application scheme, specific computer equipment It can include either combining certain components than components more or fewer shown in figure or be arranged with different components.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage on a memory And the computer program that can be run on a processor, which is characterized in that processor realizes following steps when performing computer program: Obtain character string information and the corresponding memory application information that java applet includes;Character string information is converted, is obtained Character string;Using character string and memory application information generation string request to create, string is created please It asks and is sent to host, host is made to distribute corresponding out-pile for character string from operating system memory according to memory application information Memory;It is stored character string as string to out-pile memory.
In one embodiment, following steps are also realized when processor performs computer program:When java applet starts, Java applet operation request is sent to host, host is obtained and is distributed according to java applet operation request from operating system memory JVM memories;Operating system memory includes JVM memories and target memory;JVM memories include heap memory and direct memory;Out-pile Memory includes at least one of target memory or direct memory..
In one embodiment, following steps are also realized when processor performs computer program:Character string information is carried out Deconsolidation process obtains character string.
In one embodiment, memory application information includes the target memory access information based on first interface;Processor Following steps are also realized when performing computer program:Character string information is obtained, calculates corresponding memory headroom;Compare memory headroom Size whether reach threshold value;When the size of memory headroom reaches threshold value, using character string and the mesh based on first interface Mark internal storage access information generation string request to create.
In one embodiment, memory application information includes the direct memory access information based on second interface;Processor Following steps are also realized when performing computer program:Character string information is obtained, calculates corresponding memory headroom;Compare memory headroom Size whether reach threshold value;When the size of memory headroom is not up to threshold value, using character string and based on second interface Direct memory access information generates string request to create.
In one embodiment, following steps are also realized when processor performs computer program:Character is sent to host String object quote request, string quote request carry the memory address index and character length of character string, make place Host reads corresponding character string according to memory address index and character length in out-pile memory;Character string includes multiple Character;Multiple characters that host returns are received, by the way that multiple characters are spliced, character string is converted into character string pair As.
In one embodiment, following steps are also realized when processor performs computer program:It is detected according to predeterminated frequency Whether string is cited;When string is unreferenced, from out-pile memory by corresponding string into Row release, recycles out-pile memory.
In one embodiment, a kind of computer readable storage medium is provided, is stored thereon with computer program, is calculated Machine program realizes following steps when being executed by processor:Obtain character string information and the corresponding memory Shen that java applet includes It please information;Character string information is converted, obtains character string;Utilize character string and memory application information generation character string Object Creation is asked, and string request to create is sent to host, makes host according to memory application information from operation Installed System Memory distributes corresponding out-pile memory for character string;It is stored character string as string to out-pile memory.
In one embodiment, following steps are also realized when computer program is executed by processor:When java applet starts When, java applet operation request is sent to host, host is obtained and request is run from operating system memory according to java applet The JVM memories of distribution;Operating system memory includes JVM memories and target memory;JVM memories include heap memory and direct memory; Out-pile memory includes at least one of target memory or direct memory..
In one embodiment, following steps are also realized when computer program is executed by processor:To character string information into Row deconsolidation process, obtains character string.
In one embodiment, memory application information includes the target memory access information based on first interface;Computer Following steps are also realized when program is executed by processor:Character string information is obtained, calculates corresponding memory headroom;Compare memory sky Between size whether reach threshold value;When the size of memory headroom reaches threshold value, using character string and based on first interface Target memory access information generates string request to create.
In one embodiment, memory application information includes the direct memory access information based on second interface;Computer Following steps are also realized when program is executed by processor:Character string information is obtained, calculates corresponding memory headroom;Compare memory sky Between size whether reach threshold value;When the size of memory headroom is not up to threshold value, using character string and based on second interface Direct memory access information generation string request to create.
In one embodiment, following steps are also realized when computer program is executed by processor:Word is sent to host String object quote request is accorded with, string quote request carries the memory address index and character length of character string, makes Host reads corresponding character string according to memory address index and character length in out-pile memory;Character string includes more A character;Multiple characters that host returns are received, by the way that multiple characters are spliced, character string is converted into character string Object.
In one embodiment, following steps are also realized when computer program is executed by processor:It is examined according to predeterminated frequency Survey whether string is cited;When string is unreferenced, by corresponding string from out-pile memory It is discharged, out-pile memory is recycled.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, computer program can be stored in a non-volatile computer readable It takes in storage medium, the computer program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, this Shen Any reference to memory, storage, database or other media used in each embodiment please provided, may each comprise Non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above example can be combined arbitrarily, to make description succinct, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield is all considered to be the range of this specification record.
Above example only expresses the several embodiments of the application, and description is more specific and detailed, but can not Therefore it is construed as limiting the scope of the patent.It should be pointed out that for those of ordinary skill in the art, Under the premise of not departing from the application design, various modifications and improvements can be made, these belong to the protection domain of the application. Therefore, the protection domain of the application patent should be determined by the appended claims.

Claims (16)

1. a kind of processing method of string, the method includes:
Obtain character string information and the corresponding memory application information that java applet includes;
The character string information is converted, obtains character string;
Using the character string and memory application information generation string request to create, by the string Request to create is sent to host, make the host according to the memory application information from operating system memory be the character Sequence distributes corresponding out-pile memory;
It is stored the character string as string to the out-pile memory.
2. according to the method described in claim 1, it is characterized in that, obtaining the character string information that includes of java applet and right Before the step of memory application information answered, further include:
When the java applet starts, to the host send java applet operation request, obtain the host according to The JVM memories that java applet operation request is distributed from the operating system memory;The operating system memory is included in the JVM It deposits and target memory;The JVM memories include heap memory and direct memory;The out-pile memory includes the target memory or institute State at least one of direct memory.
3. according to the method described in claim 1, it is characterized in that, converted to the character string information, character sequence is obtained The step of row, includes:
Deconsolidation process is carried out to the character string information, obtains the character string.
4. according to the method described in claim 2, it is characterized in that, the memory application information includes the mesh based on first interface Mark internal storage access information;The step of using the character string and memory application information generation string request to create Including:
The character string information is obtained, calculates corresponding memory headroom;
Whether the size for comparing the memory headroom reaches threshold value;
When the size of the memory headroom reaches threshold value, using in the character string and the target based on first interface Deposit access information generation string request to create.
5. according to the method described in claim 2, it is characterized in that, the memory application information is included based on the straight of second interface Connect internal storage access information;The step of using the character string and memory application information generation string request to create Including:
The character string information is obtained, calculates corresponding memory headroom;
Whether the size for comparing the memory headroom reaches threshold value;
When the size of the memory headroom is not up to threshold value, the character string and described based on the direct of second interface is utilized Internal storage access information generates string request to create.
6. according to the method described in claim 1, it is characterized in that, the method further includes:
String quote request is sent to the host, the string quote request carries the character sequence The memory address index and character length of row make the host according to memory address index and character length in the heap The corresponding character string is read in outer memory;The character string includes multiple characters;
Multiple characters that the host returns are received, by the way that multiple characters are spliced, the character string is converted to String.
7. according to the method described in claim 1, it is characterized in that, the method further includes:
Detect whether the string is cited according to predeterminated frequency;
When the string is unreferenced, corresponding string is discharged from the out-pile memory, it is right The out-pile memory is recycled.
8. a kind of processing unit of string, described device include:Host and operate in JVM on the host Virtual machine;When java applet is run, the JVM virtual machines be used to obtaining the character string information that the java applet includes and Corresponding memory application information, converts the character string information, obtains character string, utilizes the character string and institute Memory application information generation string request to create is stated, the string request to create is sent to host;Institute Host is stated for being distributed in corresponding out-pile for the character string from operating system memory according to the memory application information It deposits;The JVM virtual machines are additionally operable to store the character string as string to the out-pile memory.
9. device according to claim 8, which is characterized in that when the java applet starts, the JVM virtual machines are also For sending java applet operation request to the host;The host is additionally operable to be run according to the java applet and ask JVM memories are distributed from the operating system memory to the JVM virtual machines;The JVM virtual machines are additionally operable in the JVM memories The middle operation java applet;The operating system memory includes the JVM memories and target memory;The JVM memories include Heap memory and direct memory;The out-pile memory includes at least one of the target memory or the direct memory.
10. device according to claim 8, which is characterized in that the JVM virtual machines are additionally operable to the character string information Deconsolidation process is carried out, obtains the character string.
11. device according to claim 9, which is characterized in that the memory application information is included based on first interface Target memory access information;The JVM virtual machines are additionally operable to obtain the character string information, calculate corresponding memory headroom, than Whether the size of the memory headroom reaches threshold value, when the size of the memory headroom reaches threshold value, utilizes the character Sequence and the target memory access information generation string request to create based on first interface.
12. device according to claim 9, which is characterized in that the memory application information is included based on second interface Direct memory access information;The JVM virtual machines are additionally operable to obtain the character string information, calculate corresponding memory headroom, than Whether the size of the memory headroom reaches threshold value, when the size of the memory headroom is not up to threshold value, utilizes the word Accord with sequence and the direct memory access information generation string request to create based on second interface.
13. device according to claim 8, which is characterized in that when needing reference character string object, the JVM is virtual Machine is additionally operable to send string quote request to the host, and the string quote request carries the word Accord with the memory address index and character length of sequence;The host is additionally operable to according to memory address index and character length The corresponding character string is read in the out-pile memory, the character string includes multiple characters, multiple characters are returned It is back to the JVM virtual machines;The JVM virtual machines are additionally operable to by the way that multiple characters are spliced, and the character string is turned It is changed to string.
14. device according to claim 8, which is characterized in that the JVM virtual machines are additionally operable to detect according to predeterminated frequency Whether the string is cited;It, will be corresponding from the out-pile memory when the string is unreferenced String is discharged, and the out-pile memory is recycled.
15. a kind of computer equipment including memory, processor and stores the meter that can be run on a memory and on a processor Calculation machine program, which is characterized in that the processor realizes any one of claim 1 to 7 institute when performing the computer program The step of stating method.
16. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method described in any one of claim 1 to 7 is realized when being executed by processor.
CN201711433445.9A 2017-12-26 2017-12-26 Method and device for processing character string object, computer equipment and storage medium Active CN108196937B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711433445.9A CN108196937B (en) 2017-12-26 2017-12-26 Method and device for processing character string object, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711433445.9A CN108196937B (en) 2017-12-26 2017-12-26 Method and device for processing character string object, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108196937A true CN108196937A (en) 2018-06-22
CN108196937B CN108196937B (en) 2021-06-15

Family

ID=62584211

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711433445.9A Active CN108196937B (en) 2017-12-26 2017-12-26 Method and device for processing character string object, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108196937B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515703A (en) * 2019-08-29 2019-11-29 上海携程商务有限公司 JVM caching system and method
CN111854548A (en) * 2020-07-31 2020-10-30 重庆云铭科技股份有限公司 UID code feature extraction method for electronic detonator
CN113778624A (en) * 2021-08-27 2021-12-10 广州虎牙科技有限公司 Object processing method and device, intelligent terminal and storage medium
CN113900743A (en) * 2021-09-24 2022-01-07 阿里云计算有限公司 Java object access method and device
CN117973317A (en) * 2024-03-29 2024-05-03 恒生电子股份有限公司 Character string information processing method, device, electronic equipment and storage medium
CN118502968A (en) * 2024-07-17 2024-08-16 杭州乒乓智能技术有限公司 WebSocket-based data pushing method and device, computer equipment and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7743280B2 (en) * 2007-02-27 2010-06-22 International Business Machines Corporation Method and system for analyzing memory leaks occurring in java virtual machine data storage heaps
CN103558992A (en) * 2011-02-24 2014-02-05 泰若考特股份有限公司 Off-heap direct-memory data stores, methods of creating and/or managing off-heap direct-memory data stores, and/or systems including off-heap direct-memory data store
CN103678160A (en) * 2012-08-30 2014-03-26 腾讯科技(深圳)有限公司 Data storage method and device
CN106155630A (en) * 2015-04-14 2016-11-23 阿里巴巴集团控股有限公司 Sequencing method, unserializing method, serializing device and unserializing device
US9535843B2 (en) * 2015-02-17 2017-01-03 Linkedin Corporation Managed memory cache with application-layer prefetching
CN106339183A (en) * 2016-08-29 2017-01-18 东软集团股份有限公司 Data retrieving method and server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7743280B2 (en) * 2007-02-27 2010-06-22 International Business Machines Corporation Method and system for analyzing memory leaks occurring in java virtual machine data storage heaps
CN103558992A (en) * 2011-02-24 2014-02-05 泰若考特股份有限公司 Off-heap direct-memory data stores, methods of creating and/or managing off-heap direct-memory data stores, and/or systems including off-heap direct-memory data store
US20160026392A1 (en) * 2011-02-24 2016-01-28 Software Ag Usa, Inc. Off-heap direct-memory data stores, methods of creating and/or managing off-heap direct-memory data stores, and/or systems including off-heap direct-memory data store
CN103678160A (en) * 2012-08-30 2014-03-26 腾讯科技(深圳)有限公司 Data storage method and device
US9535843B2 (en) * 2015-02-17 2017-01-03 Linkedin Corporation Managed memory cache with application-layer prefetching
CN106155630A (en) * 2015-04-14 2016-11-23 阿里巴巴集团控股有限公司 Sequencing method, unserializing method, serializing device and unserializing device
CN106339183A (en) * 2016-08-29 2017-01-18 东软集团股份有限公司 Data retrieving method and server

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
DUANXZ: "堆外内存操作类ByteBuffer", 《HTTPS://WWW.BBSMAX.COM/A/GBJRNRXGJ0/》 *
佚名: "堆外内存之 DirectByteBuffer 详解", 《HTTPS://WWW.SOHU.COM/A/167784796_355142》 *
冰雨纷飞: "("深入理解JVM之JVM内存区域与内存分配", 冰雨纷飞,《https://www.cnblogs.com/wangjzh/p/5258254.html 1/》,第1-13页", 《HTTPS://WWW.CNBLOGS.COM/WANGJZH/P/5258254.HTML 1/》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515703A (en) * 2019-08-29 2019-11-29 上海携程商务有限公司 JVM caching system and method
CN111854548A (en) * 2020-07-31 2020-10-30 重庆云铭科技股份有限公司 UID code feature extraction method for electronic detonator
CN113778624A (en) * 2021-08-27 2021-12-10 广州虎牙科技有限公司 Object processing method and device, intelligent terminal and storage medium
CN113900743A (en) * 2021-09-24 2022-01-07 阿里云计算有限公司 Java object access method and device
CN117973317A (en) * 2024-03-29 2024-05-03 恒生电子股份有限公司 Character string information processing method, device, electronic equipment and storage medium
CN117973317B (en) * 2024-03-29 2024-06-07 恒生电子股份有限公司 Character string information processing method, device, electronic equipment and storage medium
CN118502968A (en) * 2024-07-17 2024-08-16 杭州乒乓智能技术有限公司 WebSocket-based data pushing method and device, computer equipment and readable storage medium

Also Published As

Publication number Publication date
CN108196937B (en) 2021-06-15

Similar Documents

Publication Publication Date Title
CN108196937A (en) Processing method, device, computer equipment and the storage medium of string
CN109445842B (en) Rule generation method, device, computer equipment and storage medium
CN109933443B (en) Inter-process communication method and device, computer equipment and readable storage medium
US9558055B2 (en) System level memory leak detection
CN107066498B (en) Key value KV storage method and device
CN110109750B (en) Virtual resource acquisition method, device, computer equipment and storage medium
CN107133174A (en) Test case code automatically generating device and method
CN110231994B (en) Memory analysis method, memory analysis device and computer readable storage medium
US20040003377A1 (en) Converting byte code instructions to a new instruction set
US20100192124A1 (en) Source code wrapper generation
CN112765023A (en) Test case generation method and device
CN109491884A (en) Code method for testing performance, device, computer equipment and medium
CN113485746B (en) Method and device for generating application program interface document
CN101840373A (en) Data operating method and device, and addressing method and device
CN107301046A (en) Treating method and apparatus, computer equipment and the storage medium of icon
CN109542719A (en) Thread state monitoring method and device, computer equipment and storage medium
CN116661910B (en) Application calling method and device
US8397217B2 (en) Integrating templates into tests
CN111552503A (en) Project file processing method and device, computer equipment and storage medium
US9639375B2 (en) Generation of language bindings for libraries using data from compiler generated debug information
CN110955434A (en) Software development kit processing method and device, computer equipment and storage medium
CN111580804B (en) Method and device for developing software project
US8819373B2 (en) Managing persistent and temporary data objects in a portable data carrier
CN105373414A (en) Method and device for realizing MIPS platform-supporting Java virtual machines
CN110865943A (en) Interface testing method and device, computer equipment and storage medium

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