Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Possible WISH LIST item?
Message
De
25/10/1998 06:15:04
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00149579
Message ID:
00150281
Vues:
38
>Let me say a wishlist item I'd much rather have is the ability to backtrack a reference and find the object/memvar that is keeping the reference count from going to zero and thus allowing the object to be removed from memory. Something on the order of a References[] collection.

This has passed unnoticed almost two months ago:

x=create("dummy")
y=x
x.releasereference
?type("x"), type("y")
?isnull(x), isnull(y)

define class dummy as custom

procedure releasereference
Local ai[1]
local i,n, lcExternalVar
n=ainstance(ai, this.class)
for i=1 to n
lcExternalVar=ai[i]
if compobj(eval(lcExternalVar), this)
release (lcExternalVar)
endif
endfor
endproc
enddefine

Though, we may not be so tough to implement this way of shoot-all-references, and, besides, this doesn't work for references in other object's properties, but I think this may be a way to go for the solution. This may be the method for Jim's FoxWish self-euthanasia of an object.

After playing some more, I've changed the code to read like this:
y=create("custom")
y.addobject("dumb", "dummy")
x=y.dumb
y.dumb.releasereference
?type("x")
if type("x")#"U"
?? "isnull=",isnull(x)
endif
?type("y")
if type("y")#"U"
?? " isnull(y)=",isnull(y)
endif
?type("y.dumb")
if type("y.dumb")#"U"
?? " isnull(y.dumb)=", isnull(y.dumb)
endif

The class definition remained the same. In the debugger I saw the AInstance() doesn't catch the y.dumb as a reference. Tried some more, and it seems that AInstance() works for simple variables used as object references, while it doesn't have any idea of any references in object properties or container members. It actually returns 0 as reference count if there's no variable reference, i.e. can't even find itself. Too bad (using 5.0, no SP).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform