TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: andrew clarke
date: 2003-02-06 08:52:10
subject: How is memory handled?

Wed 2003-02-05 10:55, Neil Heller (1:106/2000) wrote to Darin McBride:

NH> char * foo[] = "For whom the bell tolls";

...

NH> If there were more than one instance of the program running at a
NH> time,  would the actual string need to be duplicated for each
NH> instance? 

This really depends on the OS and the compiler used.  In Windows and OS/2
(probably other OSes too, eg. MacOS & BeOS) it's possible to have
resources that you can bind to an executable.  You can have string tables
(and icons, bitmaps, etc.) which can be shared by multiple instances if
they are marked "sharable". I don't think this applies to strings
within the source code though (but I suppose in theory it could, but might
slow things down a lot).

Of course, in the case of such a string placed in a DLL, multiple instances
of a program that load the DLL will share the memory where the string is
held (which is why you have to be careful when writing shared libraries).

-- mail{at}ozzmosis.com

--- timEd/Cygwin 1.11.a4
* Origin: Blizzard of Ozz, Mt Eliza, Victoria, Australia (3:633/267.1)
SEEN-BY: 633/267 270
@PATH: 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.