Supercharge Your Innovation With Domain-Expert AI Agents!

Object creation method, terminal device and storage medium

An object creation and object technology, applied in the direction of multi-program installation, creation/generation of source code, program code conversion, etc., can solve problems such as low object creation efficiency and memory optimization, and achieve the effect of reducing the number of visits and improving efficiency.

Pending Publication Date: 2020-07-17
武汉瓯越网视有限公司
View PDF6 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] In view of this, an embodiment of the present invention provides an object creation method, a terminal device, and a storage medium, which are used to solve the problem that the memory is not optimized in the current object creation method, resulting in low object creation efficiency

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Object creation method, terminal device and storage medium
  • Object creation method, terminal device and storage medium
  • Object creation method, terminal device and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0027] see figure 1 , a schematic flowchart of an object creation method provided by an embodiment of the present invention, including the following steps:

[0028] S101. Redefine the interface of the object memory allocation function and the interface of specifying the address to call the constructor;

[0029] The object memory allocation function is used to allocate memory space for the created object, and the specified address calls the callback function to generate the object through the constructor on the specified memory. Generally, during the object creation process, that is, when an object is created through the new method, memory space is randomly allocated in the system memory for the heap or stack area object, and then the construction method is called to generate the object. In the embodiment of the present invention, the memory space of the object is pre-applied, and the memory space of a predetermined size can be applied for through the object memory allocation ...

Embodiment 2

[0040] exist figure 1 on the basis of combining figure 2 The specific process of improving the efficiency of creating objects is described in detail as follows:

[0041] S201, redefine the operator new function and the placement new function;

[0042] When creating an object, the object is generally generated directly through the new operator. In the new operator, there are two processes: allocating memory and calling the constructor. The function of allocating memory in the new operator is operator new, and the function of constructing objects in the allocated memory is placement new.

[0043] Since the memory allocation of the object creation process has been completed during the program compilation, the object memory application operation can be reduced by redefining the operatornew function and the placement new function, and then combined with the redefined function to pre-apply for memory.

[0044] S202. Apply for memory space;

[0045] In the redefined operator new...

Embodiment 3

[0054] A method for creating an object is mainly described above, and a terminal device for creating an object will be described in detail below.

[0055] image 3 A schematic diagram showing the structure of a terminal device for object creation, including:

[0056] Definition module 310: used to redefine the interface of the object memory allocation function and the interface of specifying the address to call the constructor;

[0057] The object memory allocation function is used to allocate memory space for the created object, and the specified address calls the callback function to generate the object through the constructor on the specified memory. Generally, during the object creation process, that is, when an object is created through the new method, memory space is randomly allocated in the system memory for the heap or stack area object, and then the construction method is called to generate the object. In the embodiment of the present invention, the memory space of...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses an object creation method, a terminal device and a storage medium, and belongs to the technical field of application development. The method provided by the invention comprisesthe following steps: redefining an interface of an object memory allocation function and an interface of a specified address calling construction function; calling the object memory allocation function to apply for a memory space of a predetermined size; aligning pre-stored data bytes set in the memory space through an internal instruction of a system compiler; and setting the head address of thememory space as a specified memory address by utilizing the interface function of the specified address calling construction function, and creating an object at the specified address. Object creationcan be performed on the specified memory, so that the object creation efficiency is improved.

Description

technical field [0001] The invention belongs to the field of application development, and in particular relates to an object creation method, a terminal device and a storage medium. Background technique [0002] In the application development process, classes and objects are often used. During the running of the program, objects are created to encapsulate data, and the data is manipulated to perform corresponding tasks. When a large number of objects need to be created, the creation process will be very time-consuming. [0003] Currently, the most common way to create an object is to directly call the new operator, and to create an object directly through the new operator is to randomly obtain memory space. When there are a lot of memory fragments in the system, the creation efficiency is low. Contents of the invention [0004] In view of this, an embodiment of the present invention provides an object creation method, a terminal device, and a storage medium, which are use...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F8/30G06F8/41G06F9/50
CPCG06F8/30G06F8/41G06F9/5016
Inventor 黄浩
Owner 武汉瓯越网视有限公司
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More