Method and device for implementing weak reference of pool object

An implementation method and weak reference technology, applied in the computer field, can solve problems such as inability to apply Pool objects and speed up memory access to memory fragmentation.

Active Publication Date: 2019-03-26
TENCENT TECH CHENGDU
View PDF8 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, this traditional weak reference implementation method is not suitable for Pool objects. Pool objects refer to program objects that are allocated in the memory pool and can be repeatedly applied for and returned. It is very useful for speeding up memory access and reducing memory fragmentation.

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
  • Method and device for implementing weak reference of pool object
  • Method and device for implementing weak reference of pool object
  • Method and device for implementing weak reference of pool object

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0022] In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

[0023] Such as figure 1 As shown, in one embodiment, a pool object-oriented weak reference implementation method is provided, the method is applicable to the Pool object, so that the Pool object can implement the weak reference mechanism. The method includes:

[0024] Step 102, allocate an object through the Pool object pool, and set a unique identification number for the allocated object, and the identification number becomes invalid when the object is recycled to the Pool object pool.

[0025] Object refers to the abstract expression of the concept of things, data, etc. in the computer. It is a...

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 relates to a weak reference implementation method oriented to a Pool object. The method comprises the following steps: through a Pool object pool, distributing an object, and setting a unique identification number for the distributed object, wherein the identification number fails when the object is recovered to the Pool object pool; constructing a weak reference accessor, and recording the identification number of the object in the weak reference accessor; and when the object is accessed by the weak reference accessor each time, detecting whether the identification number recorded in the weak reference accessor is consistent with the identification number carried by the object, permitting to access if the weak reference accessor is consistent with the identification number carried by the object, and otherwise, forbidding to access. The method can be adopted to realize a weak reference mechanism on the Pool object. In addition, the invention also provides a weak reference implementation device oriented to the Pool object.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method and device for implementing weak references oriented to Pool objects. Background technique [0002] Weak reference is a method that is mainly used to isolate and check whether the held reference (pointer) is valid when a certain module of the program owns the ownership of the program object (life cycle control) but other modules need to access the object. [0003] In traditional technology, the lifetime of a program object is controlled by a reference count, the strong reference accessor controls the addition and subtraction of the count, and the weak reference accessor cannot modify the reference count of the object. When the count is not 0, the object is valid, and the weak reference accessor of the object is valid. When the count is 0, the object will be released by the system at the end of its lifetime, and the weak reference accessor is invalid. The weak referenc...

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
Patent Type & Authority Patents(China)
IPC IPC(8): G06F8/20G06F8/30
CPCG06F8/22G06F8/31
Inventor 邓君
Owner TENCENT TECH CHENGDU
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products