On Mon, Oct 22, 2018 at 5:10 PM Keith Culotta via 4D_Tech < 4d_tech@lists.4d.com> wrote:
> If a method creates an object ($no:=new object), the object is destroyed > when the method ends? > and > if a method creates a new shared object ($nso:=new shared object), the > object continues to exist after the method ends, but the reference to it is > lost? Does 4D know to clear the object in this case? > > Keith, AFAIK, object - standard or shared - is destroyed when it refcount is zero, what means when there is nothing that references it anymore. This means that when a method creates new object $no:=New object fact that $no is local variable matters to the extend that, when methods ends, $no gets out of scope and the refcount of the object is decreased by 1. If no other variable refers to the object, it is destroyed. However, there may be other variables that refer to that object, if you do something like procesVar:=$no or SomeMethod($no) In this case, object exist till last variable stopp to reference it. -- Peter Bozek ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************