STATIC Variable Memory 
Author Message
 STATIC Variable Memory

How does the STATIC variable memory gets freed?  I declare local STATIC
variables in some procedure.  Do the static memory gets freed when the
procedure closes?  Would this create a memory leak?

Any suggestion on this would be helpful.
Thanks,
Sukhendu Barua



Sun, 15 May 2005 08:16:15 GMT  
 STATIC Variable Memory
the memory is allocated for the life of the process.  even after the
procedure closes the static value is retained. no memory leak but has same
effect as a global variable on memory allocation.
jim kane

Quote:
> How does the STATIC variable memory gets freed?  I declare local STATIC
> variables in some procedure.  Do the static memory gets freed when the
> procedure closes?  Would this create a memory leak?

> Any suggestion on this would be helpful.
> Thanks,
> Sukhendu Barua



Sun, 15 May 2005 11:50:56 GMT  
 STATIC Variable Memory
STATIC memory is allocated and deallocated from heap by
compiler code.

Quote:

> How does the STATIC variable memory gets freed?  I declare local STATIC
> variables in some procedure.  Do the static memory gets freed when the
> procedure closes?  Would this create a memory leak?

> Any suggestion on this would be helpful.
> Thanks,
> Sukhendu Barua

--
 Randy Goodhew
 ---[ eQ ]---


Sun, 15 May 2005 21:41:20 GMT  
 STATIC Variable Memory
Thanks Jim and Randy for your comments.

So STATIC memory can be viewd as global data?

Thanks
Sukhendu Barua


Quote:
> STATIC memory is allocated and deallocated from heap by
> compiler code.


> > How does the STATIC variable memory gets freed?  I declare local STATIC
> > variables in some procedure.  Do the static memory gets freed when the
> > procedure closes?  Would this create a memory leak?

> > Any suggestion on this would be helpful.
> > Thanks,
> > Sukhendu Barua

> --
>  Randy Goodhew
>  ---[ eQ ]---



Sun, 15 May 2005 22:12:57 GMT  
 STATIC Variable Memory
STATIC variables can have a scope of GLOBAL, MODULE, or LOCAL.
GLOBAL and MODULE are always STATIC.
LOCAL data requires a 'STATIC' attribute on the declaration.
Data created with NEW is STATIC until DISPOSEd.

Read the docs for more info.

Quote:

> Thanks Jim and Randy for your comments.

> So STATIC memory can be viewd as global data?

> Thanks
> Sukhendu Barua



> > STATIC memory is allocated and deallocated from heap by
> > compiler code.


> > > How does the STATIC variable memory gets freed?  I declare local STATIC
> > > variables in some procedure.  Do the static memory gets freed when the
> > > procedure closes?  Would this create a memory leak?

> > > Any suggestion on this would be helpful.
> > > Thanks,
> > > Sukhendu Barua

> > --
> >  Randy Goodhew
> >  ---[ eQ ]---

--
 Randy Goodhew
 ---[ eQ ]---


Mon, 16 May 2005 01:25:08 GMT  
 STATIC Variable Memory
Thanks Randy.
Sukhendu


Quote:
> STATIC variables can have a scope of GLOBAL, MODULE, or LOCAL.
> GLOBAL and MODULE are always STATIC.
> LOCAL data requires a 'STATIC' attribute on the declaration.
> Data created with NEW is STATIC until DISPOSEd.

> Read the docs for more info.


> > Thanks Jim and Randy for your comments.

> > So STATIC memory can be viewd as global data?

> > Thanks
> > Sukhendu Barua



> > > STATIC memory is allocated and deallocated from heap by
> > > compiler code.


> > > > How does the STATIC variable memory gets freed?  I declare local
STATIC
> > > > variables in some procedure.  Do the static memory gets freed when
the
> > > > procedure closes?  Would this create a memory leak?

> > > > Any suggestion on this would be helpful.
> > > > Thanks,
> > > > Sukhendu Barua

> > > --
> > >  Randy Goodhew
> > >  ---[ eQ ]---

> --
>  Randy Goodhew
>  ---[ eQ ]---



Mon, 16 May 2005 01:30:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. static functions and required runtime memory

2. VO dynamic vs static memory

3. Static vs. Dynamic Typing -- the Memory Lapse Problem

4. Why is memory footprint smaller when compiled static?

5. static memory allocation and addressing

6. Help with static memory allocation (3-d array)

7. Cache/static Memory

8. Fortran IV -- static memory model?

9. SGI Fortran: static vs allocated memory

10. Preventing MSVC in showing static allocation as memory leaks

11. Static variables in SmallScript?

12. What's a STATIC GLOBAL variable?

 

 
Powered by phpBB® Forum Software