From: Eric Wong Date: 2011-06-09T17:17:35+09:00 Subject: [ruby-core:36878] Re: [Ruby 1.9 - Feature #3905] rb_clear_cache_by_class() called often during GC for non-blocking I/O Charles Oliver Nutter wrote: > On Wed, Jun 8, 2011 at 4:00 PM, Eric Wong wrote: > > Charles Nutter wrote: > >> What's the effect of the EPHEMERAL flag if someone takes an object > >> with an attached ephemeral class and starts making singleton changes > >> to that object? Do those changes properly flush cache? Nevermind, I misread the first time and got ordering of your question mixed up in my mind. Once a class is tagged RCLASS_EPHEMERAL, it's impossible for it to write to the cache. There's no need to flush the cache for ephemeral classes because... > > No, it's a situation where the user must be careful and not shoot > > themselves in the foot. ??It is C, after all. ...the the /only/ safe way to use RCLASS_EPHEMERAL is before any methods are called (and cached) for the singleton class. > But isn't this an exception object that will be raised into Ruby code? > In other words... > > begin > io.read_nonblock > rescue WaitReadable => e > class << self > # add something cute Any methods defined here will never be cached, because RCLASS_EPHEMERAL was set before we re-entered Ruby-land.