# System handling of undef\_method

**URL:** <https://www.ruby-forum.com/t/system-handling-of-undef-method/183718>\
**Category:** Ruby\
**Created:** [February 19, 2010, 1:34am UTC](https://www.ruby-forum.com/t/system-handling-of-undef-method/183718 "2010-02-19T01:34:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_F\_Fraser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3d9bf3/32.png) [@Paul\_F\_Fraser](https://www.ruby-forum.com/u/Paul_F_Fraser)\
**Post date:** [February 19, 2010, 1:34am UTC](https://www.ruby-forum.com/t/system-handling-of-undef-method/183718/1 "2010-02-19T01:34:37Z")

</div>

When a method is undefined, does the code hang around as orphaned code,  
or is it garbage collected and totally removed, or some other action  
performed?  
I am interested in the case of many methods being added for limited use  
and the effect on code size and performance.  
Paul F Fraser

---

<div class="post-metadata">

**Author:** ![Paul\_F\_Fraser](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3d9bf3/32.png) [@Paul\_F\_Fraser](https://www.ruby-forum.com/u/Paul_F_Fraser)\
**Post date:** [February 19, 2010, 1:40am UTC](https://www.ruby-forum.com/t/system-handling-of-undef-method/183718/2 "2010-02-19T01:40:28Z")

</div>

Hi,

In message “Re: System handling of undef\_method”  
on Fri, 19 Feb 2010 09:34:11 +0900, Paul F Fraser  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|When a method is undefined, does the code hang around as orphaned code,  
|or is it garbage collected and totally removed, or some other action  
|performed?

If the method is defined in the undef’ing class, the code will be  
garbage collected. If the method is defined in the superclass, it’s  
just overridden.

```
          matz.

```
