- Q What should my daily intake of calories be?
- Q Which of the following acts suggested the post of comptroller and auditor general-
- Q 1838 Los Angeles man needed a licence to do what to a woman..
- Q Which attribute of text tag of svg sets the rotation to be applied to all glyphs?
- Q What does mgmt-user.properties contain?
- Q State the number and type of registers in the 8086?
- Q What is the maximum Tx configuration for GSM? How it can be managed?
- Q Ruby and sapphire are the oxides of –
- Q WHICH STATE PRODUCED CARDAMOM HIGHER THAN ANY OTHER SATES IN INDIA?
- Q What is an iterator?
- Q Give few examples for solutions that support cluster storage ?
Question
Why does a large static array bloat my executable file size?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Answers
Given the declaration:
char[1024 * 1024] arr;
the executable size increases by a megabyte in size. In C, this would not as arr would be stored in the BSS segment. In D, arr is not stored in the BSS segment because:
The char type is initialized to 0xFF, not 0. Non-zero data cannot be placed in BSS.
Statically allocated data is placed in thread local storage. The BSS segment is not thread local, and there is no thread local equivalent of BSS.
The following will be placed in BSS:
__gshared byte[1024 * 1024] arr;
as bytes are 0 initialized and __gshared puts it in the global data.
There are similiar issues for float, double, and real static arrays. They are initialized to NaN (Not A Number) values, not 0.
The easiest way to deal with this issue is to allocate the array dynamically at run time rather than statically allocate it. Your Comment
char[1024 * 1024] arr;
the executable size increases by a megabyte in size. In C, this would not as arr would be stored in the BSS segment. In D, arr is not stored in the BSS segment because:
The char type is initialized to 0xFF, not 0. Non-zero data cannot be placed in BSS.
Statically allocated data is placed in thread local storage. The BSS segment is not thread local, and there is no thread local equivalent of BSS.
The following will be placed in BSS:
__gshared byte[1024 * 1024] arr;
as bytes are 0 initialized and __gshared puts it in the global data.
There are similiar issues for float, double, and real static arrays. They are initialized to NaN (Not A Number) values, not 0.
The easiest way to deal with this issue is to allocate the array dynamically at run time rather than statically allocate it. Your Comment
- 0
- 0
- New Answer
- Contributors: *,
More Software Questions..
What is the inputsplit in map reduce software?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How can you implement fine-grained auditing?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is IBM’s simple explanation for Big Data’s four critical features?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What does the NULLIF function do?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What happens if a start method is not invoked and the run method is directly invoked?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
what is the difference between mysql_fetch_array and mysql_fetch_object?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How will XML affect my document links?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Why to use Style Sheets?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are Filters in MVC?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can you explain Application layer in OSI model?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How to define new testplan attributes?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Which oracle package is used to manage the oracle lock management services?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is marker interface?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What types of partitioning are there for BW?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,