[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] looking for a "magic" pointcut for ...

use PhantomReferences to determine exactly when an object was removed from memory

http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html

--
Dehua (Andy) Zhang
Sable Research Group, McGill University
Montréal, Québec, Canada
http://www.cs.mcgill.ca/~dzhang25





-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Eric Bodden
Sent: Sun 11/11/2007 10:55
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] looking for a "magic" pointcut for ...
 
You could probably build one on your own via testing a weak reference
in an if-pointcut. However, you would need to poll this reference over
and over again. I don't think there's any way to have the garbage
collector call you when an object is GC'ed. Having said that, you
*could* probably attach an advice to the finalize() method, but as the
documentation says, finalizers are not guaranteed to be run, or if
they are run you get no guarantee about when or in which order. They
may even run in parallel, if I remember correctly.

Eric

On 11/11/2007, Jean-Louis.Pasturel <jean-louis.pasturel@xxxxxxxxx> wrote:
> Hi,
> Is there a "magic" pointcut for detecting when an object :
> - is finalized or this object is no more referenced ( object=null ;) ?
> - is garbagged ?
>
>
> Is-it only possible with AspectJ ?
>
> Best Regards
> Jean-Louis
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users