home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!uwm.edu!linac!att!att!dptg!ulysses!allegra!princeton!fine.princeton.edu!igor
- From: igor@fine.Princeton.EDU (Igor Rivin)
- Subject: strange compiler behavior
- Message-ID: <1993Jan23.043404.20003@Princeton.EDU>
- Originator: news@nimaster
- Sender: news@Princeton.EDU (USENET News System)
- Nntp-Posting-Host: math.princeton.edu
- Organization: Princeton University
- Date: Sat, 23 Jan 1993 04:34:04 GMT
- Lines: 32
-
-
- Why is it that if you declare an uninitialized global array,
- three times as much virtual space as necessary gets allocated?
-
- Trivial example program:
-
- #include <stdio.h>
-
- char dog[100000];
-
- main() {}
-
-
- result of of running size on the executable:
-
- cc -o stupid1 stupid.c
- vulcan% size stupid1
-
- Size of stupid1:380688
-
- Section Size Physical Address Virtual Address
-
- .text 5984 4194672 4194672
- .init 32 4200656 4200656
- .data 2704 268435456 268435456
- .sdata 112 268438160 268438160
- .sbss 96 268438272 268438272
- .bss 371760 268438368 268438368
-
-
- Inquiring minds want to know...
-
-