Re: Heap allocation
From: SM Ryan (wyrmwif_at_tango-sierra-oscar-foxtrot-tango.fake.org)
Date: 09/01/04
- Next message: SM Ryan: "Re: ifeq or ifdef in Makefile problems"
- Previous message: SM Ryan: "Re: Xah Lee's Unixism"
- In reply to: asm: "Heap allocation"
- Next in thread: James Antill: "Re: Heap allocation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 01 Sep 2004 19:06:18 -0000
arut@post.com (asm) wrote:
# Hi All,
#
# When a process allocates dynamic storage by making a call
# to malloc(), does it get allocated from a per process heap
# or a system wide heap?
Per process. Unless you do something like shmat or mmap, all your
writable memory belongs to your process alone. And when you fork,
the child process get its own copy of the heap, so the heaps of
parent and child are separate and still only belongs to the one
process.
System V shared memory and memory mapped files do allow different
processes to share memory, but your process must make system calls
to set up such regions--they won't happen behind your back.
(Read and execute only code loaded from the executable may be
handled with something similar to mmap; but since nobody can write
these pages, it is irrelevant whether they are shared or not.)
-- SM Ryan http://www.rawbw.com/~wyrmwif/ Death is the worry of the living. The dead, like myself, only worry about decay and necrophiliacs.
- Next message: SM Ryan: "Re: ifeq or ifdef in Makefile problems"
- Previous message: SM Ryan: "Re: Xah Lee's Unixism"
- In reply to: asm: "Heap allocation"
- Next in thread: James Antill: "Re: Heap allocation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|