On 10/19/14, 9:40 AM, WangChen wrote: > Thanks for your quick response. > > But I don’t think intern will suits here. > I mean my program need to create 1 billion instances of Data class. And all > of them are different. > > So then what "extra space" are you referring to? If you are talking of the space for the object header I don't think that is significant, given all the space u r using for date objects anyway.
In any case, you can always use a struct if u r concerned about space overhead (though I don't think that is the issue here). If you want to have a mutable field f of type T use one level of indirection and have an immutable field f of type Cell[T], e.g.: val value: Cell[Int] now instead of writing d.value = 35; to mutate the field, you would write d.value() = 35; Hope this helps, Vijay ------------------------------------------------------------------------------ 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