Date: Thu, 15 Jan 1998 10:04:01 +0900 (JST) From: Michael Hancock <michaelh@cet.co.jp> To: Joel Ray Holveck <joelh@gnu.org> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: sharable static arrays? Message-ID: <Pine.SV4.3.95.980115095903.22515A-100000@parkplace.cet.co.jp> In-Reply-To: <199801140430.WAA03884@detlev.UUCP>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 13 Jan 1998, Joel Ray Holveck wrote: > Are arrays declared const shared across multiple invocations of a > program? > > That is, if I have an array > const int foo[8192] = {...}; > then will each instance of the invocation separately allocate 16k for > an array that's never going to change, and exists as it is in the > executable? It depends on how it's defined and scoped. Try different combinations of defining "const int foo" and move them around your foo.c file. Try these: Module scope Function scope Function scope and defined static Then run nm on the a.out and look for foo. If there's a big T or little t in front of it then the storage is in text which is mapped read-only and shared. Regards, Mike Hancock > Cheers, > joelh > > -- > Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan > Fourth law of programming: > Anything that can go wrong wi > sendmail: segmentation violation - core dumped > -- michaelh@cet.co.jp http://www.cet.co.jp CET Inc., Daiichi Kasuya BLDG 8F 2-5-12, Higashi Shinbashi, Minato-ku, Tokyo 105 Japan Tel: +81-3-3437-1761 Fax: +81-3-3437-1766
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.95.980115095903.22515A-100000>