Weak reference implementation method and device oriented to 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: 2016-10-12
TENCENT TECH CHENGDU
View PDF8 Cites 5 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
  • Weak reference implementation method and device oriented to Pool object
  • Weak reference implementation method and device oriented to Pool object
  • Weak reference implementation method and device oriented to Pool object

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0022] In order to make the objectives, technical solutions and advantages of the present invention clearer, the following further describes the present invention in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

[0023] Such as figure 1 As shown, in one embodiment, a method for implementing a weak reference for a Pool object is provided. The method is suitable for a Pool object, so that the Pool object can implement a weak reference mechanism. The method includes:

[0024] Step 102: Allocate objects through the Pool object pool, and set a unique identification number for the allocated objects. The identification number becomes invalid when the object is recycled into the Pool object pool.

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

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 present invention relates to the field of computer technology, in particular to a method and device for implementing weak references for Pool objects. Background technique [0002] Weak reference is a method 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 right) but other modules need to access the object. [0003] In traditional technology, the life of a program object is controlled by reference counting, 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's lifetime will be released by the system and the weak reference accessor is invalid. The weak reference accessor for each object is...

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 Applications(China)
IPC IPC(8): G06F9/44
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