git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4967 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-10-04 09:48:57 +00:00
parent de814a77a0
commit 3a45d61bf4
4 changed files with 74 additions and 6 deletions

View file

@ -1,3 +1,7 @@
Mon Sep 4 11:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/gdomap.c: better debug output (hopefully)
Wed Sep 29 21:34:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSData.m: More GC updates (atomic data buffer)

View file

@ -152,10 +152,75 @@ Type @code{make install} to install the libraries and programs
@chapter Implementation Details
@menu
* Memory Management::
* Time Zone::
@end menu
@node Time Zone, , Implementation, Implementation
@node Memory Management, Time Zones, Implementation, Implementation
@section Memory Management
The OpenStep standard defines an reference-count based memory management scheme which the GNUstep libraries support. GNUstep also supports garbage collection
using the Boehm conservative garbage collecting library, though this is
currently (October 1999) in a pre-alpha state.
@menu
* Memory Allocation::
* Reference Counting::
* Garbage Collection::
@end menu
@node Memory Allocation, , Reference Counting, Memory Management
@section Memory Allocation
Normally, memory is allocated in zones. Most memory is allocated from a
default area (returned by the NSDefaultMallocZone()) function. In some cases
where you want to ensure that a group of objects are all located in roughly the
same area of memory (for performance reasons) you might create a special zone
and allocate the objects fromn that area.
At a low-level, memory allocation is performed by two functions -
NSAllocateObject() and NSDeallocateObject(), but you need never normally deal
with these functions - they are there for when you need an unusual degree of
control or performance. These are the functions called by
[NSObject +allocWithZone:] and [NSObject -dealloc]. If you call
NSAllocateObject() directly to create an instance of a class, you may break
some functionality of that class (such as caching of frequently used objects).
Generally, objects are created using the methods +alloc, -copy, -mutableCopy
and are destroyed using -dealloc. The allocation methods are covers for the
more versatile +allocWithZone:, -copyWithZone: and -mutableCopyWithZone:
methods. NSObject also provides +new, which is simply a cover for the
combination of a +alloc and a -init.
@node Reference Counting, Memory Allocation, Garbage Collection, Memory Management
@section Reference Counting
The reference counting scheme for object allocation/deallocation is quite
simple. Objects are normally created with a reference count of 1. An objects
reference count may be increased by callsing -retain, and decreased by calling
-release. If a -releae would make the reference count become zero, the
-dealloc method is automatically called to destroy the object - freeing its
memory.
This simple scheme then becomes more complicated with the addition of
the -autorelease method. When -autorelease is called for an object, the
object is added to the currently active autorelease pool. When the autorelease
pool is later destroyed, every object in the pool will have a -release message
sent to it for each time it was added to the pool. Thus, sending an
-autorelease method to an object is equivalent to sending a -release at some
future point.
In general, when a method (other than the alloc..., copy..., mutableCopy...
and new... methods) returns an object, that object will have been autoreleased,
so you don't need to worry about releasing it yourself. However, if you wish
to store the object for any length of time, you will need to send it a retain
message, and then send it a release when you have finished with it.
@node Garbage Collection, Reference Counting, Memory Management, Memory Management
@section Garbage Collection
@node Time Zone, , Memory Management, Implementation
@section Time Zones
If the GNUstep time zone datafiles become too out of date, one can

View file

@ -3156,16 +3156,15 @@ printf(
* Ensure we don't have any open file descriptors which may refer
* to sockets bound to ports we may try to use.
*
* Use '/dev/tty' to produce logging output and use '/dev/null'
* for stdin and stdout.
* Use '/dev/null' for stdin and stdout. Assume stderr is ok.
*/
for (c = 0; c < FD_SETSIZE; c++)
{
(void)close(c);
if (c != 2)
(void)close(c);
}
(void)open("/dev/null", O_RDONLY); /* Stdin. */
(void)open("/dev/null", O_WRONLY); /* Stdout. */
(void)open("/dev/tty", O_WRONLY); /* Stderr. */
init_my_port(); /* Determine port to listen on. */
if (interfaces == 0)

View file

@ -209,7 +209,7 @@ typedef struct {
#define GDO_REQ_SIZE sizeof(gdo_req) /* Size of a request packet. */
/*
* If you have a fascist sysadmin who wqill not let you run gdomap
* If you have a fascist sysadmin who will not let you run gdomap
* as root and will not even let you modify /etc/services to point
* gdomap to another port, you can uncomment the next #define to
* run gdomap on port 6006 (or modify this to a port of your choice).