Results 1 to 4 of 4

Thread: static variable vs Global variable

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2005
    Posts
    230

    static variable vs Global variable

    hi guys, i just want to know if static local variable consume less memory than global variable

    Thanks

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: static variable vs Global variable

    A quote:
    18. Use Module-Level Variables Instead Of "Static" Local Variables [0114]
    While static variables are useful for storing values between multiple executions of a procedure, they are slower than local variables. By storing the same value in a module-level variable your procedure will execute faster. Note, however, that you will need to make sure that only one procedure is allowed to change the module-level variable. The tradeoff here is that code will be less readable and harder to maintain.
    from Performance Tuning Tips

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2005
    Posts
    230

    Re: static variable vs Global variable

    speed doesn't matter for me
    my question is which one cosume less memory

  4. #4
    Fanatic Member
    Join Date
    May 2004
    Location
    Granby, Qc, Canada
    Posts
    602

    Re: static variable vs Global variable

    I'm not sure but if it's faster, that means it takes less memory to run

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