The application provides a method for recording object references based on threads in
Java, comprising the following steps: obtaining all reference types of C++ holding
Java objects in a
system; creating reference interfaces according to the reference types respectively; classifying all reference interfaces to obtain a plurality of reference interface sets; creating encapsulation classes respectively to encapsulate any reference interface set; and establishing statistical interfaces in the encapsulation classes respectively to count the reference quantity corresponding to any
reference type, wherein the application counts the reference quantity corresponding to different reference types according to all reference types of C++ holding
Java objects, and then obtains the resource leakage situation of any
reference type, which is beneficial to investigation according to the reference types.