dwl10@uts.amdahl.com (Dave Lowrey) (06/07/89)
I would like to be able to:
1. Have a program allocate & initialize some memory
2. That program exits.
3. Have another program be able to find that memory.
Is there some way I can do this?
--
"What is another word | Dave Lowrey | [The opinions expressed MAY be
for 'Thesaurus'?" | Amdahl Corp. | those of the author and are not
| Houston, Texas | necessarily those of his
Steven Wright | amdahl!dwl10 | employer] (`nuff said!)
page%swap@Sun.COM (Bob Page) (06/08/89)
dwl10@uts.amdahl.com (Dave Lowrey) wrote: > 1. Have a program allocate & initialize some memory > 2. That program exits. > 3. Have another program be able to find that memory. Here's an ugly way to do it - have the program 'mark' the start address someplace. Either a known file name, an environment variable, a known port name, etc. Then have the second task deallocate the memory and remove the 'marker' when it's done with it. Make sure both tasks agree on how much memory is allocated, or allow the second one to find out. Don't use malloc, the C compiler's runtime library will deallocate the memory when you exit. ..bob
451061@UOTTAWA.BITNET (Valentin Pepelea) (06/08/89)
Dave Lowrey <dwl10@uts.amdahl.com> writes in Message-ID: <d4nD02AQ32cd01@amdahl.uts.amdahl.com> > I would like to be able to: > 1. Have a program allocate & initialize some memory > 2. That program exits. > 3. Have another program be able to find that memory. 1. Allocate & initialize memory. 2. Create a message port with name "MyPort". 3. Send a message to the port telling where the memory block is. 4. Program exits. 5. Another program then will FindPort("MyPort"). 6. Then get the message from that port. 7. Now you have the pointer to your memory block. Valentin _________________________________________________________________________ "An operating system without Name: Valentin Pepelea virtual memory is an operating Phonet: (613) 231-7476 (New!) system without virtue." Bitnet: 451061@Uottawa.bitnet Usenet: Use cunyvm.cuny.edu gate - Ancient Inca Proverb Planet: 451061@acadvm1.UOttawa.CA
rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (06/08/89)
In article <108611@sun.Eng.Sun.COM>, page%swap@Sun.COM (Bob Page) writes: > dwl10@uts.amdahl.com (Dave Lowrey) wrote: > > 1. Have a program allocate & initialize some memory > > 2. That program exits. > > 3. Have another program be able to find that memory. > Here's an ugly way to do it - have the program 'mark' the start Just call AddLibrary() with a proper library structure. A library doesn't necessarily have to have functions (except two or three very simple ones) and it can have any amount of data. By setting the open count to `1' or greater, the thing will stay in memory---and it can be reclaimed and freed easily when necessary. References: `set' (on a very early fish disk by yours truly) and `mylib' (on another fish disk by Jim Mackraz.) Go for it! -tom