swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Zone usage: alloc: vs. allocBlock:


From: Ken Cline
Subject: Zone usage: alloc: vs. allocBlock:
Date: Tue, 20 Jul 1999 19:37:17 -0400 (EDT)

Hi!

Are there guidelines for when to use the Zone's `allocBlock:'
method instead of `alloc:'?

The only difference that I saw mentioned in the documentation
was pertaining to which deallocation method must be used to
free the associated block.  Are the methods equivalent 
otherwise?

I have an example where `allocBlock:' seems to work but 
`alloc:' does not.  In the following code fragment I receive
a bus error when the return value from `atof' is assigned to
`*d':
     ...
   if ( ! value ) {
     double * d = (double *)[ [self getZone] alloc: sizeof(double) ];
     *d = atof( value );
     [ values at: (id)name insert: (id)d ];
   }
     ...
The bus error doesn't occur if you use `allocBlock:'.  Is 
there something (probably quite simple) that I'm missing?


Thanks!

Ken.


_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427






                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]