On Tue, Jul 24, 2007 at 01:18:24PM +0400, Gregory Shimansky wrote: > >On 7/23/07, Alexei Fedotov <[EMAIL PROTECTED]> wrote: > >>> These object references are enumerated as weak > >>There might be a coincidence with the message Harmony VM continues to > >>print: > >>The GC did not provide gc_add_weak_root_set_entry()
I think the analysis by Alexei is correct. GC_gen does not implement weak roots, so the VM emulates it using regular gc_add_root_set_entry() function, and the tagged objects end up not being collected at all. The last boolean parameter to gc_add_weak_root_set_entry() is not relevant, as Gregory correctly pointed out, as it controls only if the weak root will behave as weak reference or as phantom reference, i.e. will be reset as soon as objects becomes unreachable for the first time, or only after its finalization has completed. > Other solution would be to allocate tags inside of objects themself > inside of heap, but there is a big problem with it because spec states > that tags are local to JVMTI environment. If an agent creates many > environments, or if there is more than JVMTI agent, it may be necessary > to associate different environments with the same object. Many environments requirement is not a real problem, at least current implementation allows using tags only for one environment, and returns "not available" code for all other environment attempting to request this capability. What does prevents putting tags into the objects directly, is the requirement to enumerate tagged objects quickly, as this is likely to be used by memory profilers, and the performance of O(tagged) is much more preferrable than O(all objects). Current implementation puts a pointer to a native tag structure into objects. Xiao Feng, what other solutions do you consider?
