Results 1 to 11 of 11

Thread: [2.0] issue on memory management

Threaded View

  1. #1

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    [2.0] issue on memory management

    Hi all,

    We in the team have an issue|debit about the coding standard in terms in memory management.
    We have 2 codes that we proposed and we need to choose the better one.

    // code1

    Code:
    {
         object o1 = null;
         try
         {
            using (o1 = new object}
             {
            // code here
             }
          }
         catch
         {  // code here
       }
         finally
         {
          o1 = null;
         }
    }
    vs
    code2
    Code:
    {
          try
         {
            using (object o1 = new object}
             {
            // code here
             }
          }
         catch
         {  // code here
       }
    }
    Code2 dispose the object but not set to null. And if you what is your choice? code 1 or code 2. Any inputs, idea. Thanks!


    Popskie

Posting Permissions

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



Click Here to Expand Forum to Full Width