[Newbies] Tracing back objects

Bert Freudenberg bert at freudenbergs.de
Fri May 25 12:30:56 UTC 2007

On May 25, 2007, at 12:18 , subbukk wrote:

> Hi,
> The following code:
>  CompiledMethod allInstances inject: (CompiledMethod allInstances  
> first) into:
> [:m :i | i size > m size ifTrue: [i] ifFalse: [m]].
> gives the largest method as an object.

Note that

	CompiledMethod someInstance

is much more efficient than

	CompiledMethod allInstances first

> Is there an efficient way to trace back
> the method selector and its class without doing a brute force lookup?

Not in 3.8, but I think later versions might cache the owner of CMs.  
Anyway, you might want to try this:

(CompiledMethod allInstances detectMax: [:m | m size]) who

- Bert -

More information about the Beginners mailing list