New topic: Proper way to destruct a class
<http://forums.realsoftware.com/viewtopic.php?t=45716> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message software-maniac Post subject: Proper way to destruct a classPosted: Wed Oct 24, 2012 9:15 pm Joined: Sun Apr 29, 2007 11:26 am Posts: 19 Location: Seattle, WA If I have a class named clsName is instantiated: Dim cs As New clsName .. ' Do stuff with cs cs = Nil Is the proper way to destruct a class by assigning Nil to it. Thank you! Ken Top mauitom Post subject: Re: Proper way to destruct a classPosted: Wed Oct 24, 2012 10:53 pm Joined: Thu Feb 16, 2006 10:04 pm Posts: 237 Yes, that works fine, doesn't hurt, but you don't have to. For the most part, you don't have to worry about memory management with Real Studio, it's taken care for you. Top charonn0 Post subject: Re: Proper way to destruct a classPosted: Wed Oct 24, 2012 11:53 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 937 Location: San Francisco, CA, USA RealBasic uses reference-counting to keep track of when an object can be destroyed. If an object only has one reference, then assigning the reference to Nil will destroy the object; if there are more than one then the object is not destroyed, merely the reference is no longer valid. This is not generally a problem however, since if your application has multiple references to instances of objects then you either did it on purpose or your code has more serious issues. _________________ Boredom Software Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
