> allocRailZeroed does an allocate followed by a memset
> 
> allocRailUninitialized does an allocate without the memset.
> 
> clearRail does a memset of a portion of a Rail. 

Thanks for explanation


> We tend to use allocRailUninitialized as a performance optimization when we 
> know that we are "just about" to overwrite the allocated memory with initial 
> values.  So, no point in first writing zeros, then writing some other value.
> 
> In GrowableRail, you are seeing some accommodations for advanced features of 
> X10's type system.  It is possible to define a type in X10 that does not 
> include zero (or null).  We'd still like to be able to create GrowableRails 
> that contain values of these types, but the > type doesn't have a zero/null 
> value for us to use to fill in the unused part of the Rail.  So we use 
> methods in Unsafe like clearRail to allow us to write a zero bytes into the 
> Rail to clear a removed element even if that isn't legal at the level of the 
> X10 type system. 

I phrased my initial question rather badly. The actual question is, why do you 
ever have to zero any elements of the rail, because as far as I can see no 
element of GrowableRail should should ever be accessed without first setting it 
with add, insert etc. Does this have something to do with Rail storing 
references instead of objects and gargage collection?

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to