www.webdeveloper.com
Results 1 to 2 of 2

Thread: Releasing Custom Objects resources

  1. #1
    Join Date
    Jul 2006
    Posts
    146

    Releasing Custom Objects resources

    Hello,

    I have a custom object that i am instantiating repeatedly in a for loop. With each loop, the object is instantiated with different values.

    I want to make sure that i don't have extra memory resources being used for past objects. Will using the unset() method on objects at the end of each loop cycle serve my needs ?

    Or, will the php server be smart enough to know that i am not going to use those objects created from previous loop iterations ?

  2. #2
    Join Date
    Sep 2008
    Posts
    408
    unset would work or reusing the same variable name

    PHP Code:
    for($i=0;$i<10;++$i):
        
    $Object = new Object;
        
    $Object->stuff();
    endfor; 
    Each time $Object would be the new Object.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles