Re: How to reduce Zero Initialised region.
- From: Thad Smith <ThadSmith@xxxxxxx>
- Date: Wed, 31 Jan 2007 10:25:37 -0700
Ajai Jose wrote:
On Jan 31, 4:48 pm, "Samuel Stearley" <nya...@xxxxxxxxx> wrote:
1. Am I right in doing this (passing pointer instead of making the data structure static) ?
That will make the executable larger. How much increase can be
tolerated?
I mean passing an extra parameter to a function might increase code
size(text segment). Some additional code for sending the parameter
during function prolog. that is all the penalty right ?
but it will free some space of the ZI region when it comes to big
arrays.
Why do you want to reduce the size of only zero-initialized RAM?
I assume that code and data are in separate memory spaces. Usually, though, the zero-initialized static data area, data area allocated to automatic variables (normally on a stack), and the heap all share the same physical memory, which is divided according to the program usage (although there are cases in which some memory is battery-backed, which other is not).
You can reduce RAM requirements by replacing local static variables with automatic variables if the value does not need to be carried from one invocation to another. That allows the memory to be shared among several functions that execute at different times. There is no need to pass pointers if there is no data involved.
--
Thad
.
- Follow-Ups:
- Re: How to reduce Zero Initialised region.
- From: Chris Dollin
- Re: How to reduce Zero Initialised region.
- References:
- How to reduce Zero Initialised region.
- From: Ajai Jose
- Re: How to reduce Zero Initialised region.
- From: Samuel Stearley
- Re: How to reduce Zero Initialised region.
- From: Ajai Jose
- How to reduce Zero Initialised region.
- Prev by Date: variable initialization / I'm a n00b
- Next by Date: Re: How to reduce Zero Initialised region.
- Previous by thread: Re: How to reduce Zero Initialised region.
- Next by thread: Re: How to reduce Zero Initialised region.
- Index(es):
Relevant Pages
|