# Rb\_clear\_cache\_by\_class

**URL:** <https://www.ruby-forum.com/t/rb-clear-cache-by-class/115260>\
**Category:** Development\
**Created:** [September 22, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/rb-clear-cache-by-class/115260 "2007-09-22T19:11:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [September 22, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/rb-clear-cache-by-class/115260/1 "2007-09-22T19:11:44Z")

</div>

e$B0J2\<$NI=L@$O@5$7$$$G$7$g$&$+e(B?

e$B$D$^$j!“e(Brb\_clear\_cache\_by\_class e$B$K$\*$$$Fe(B ent-\>method  
e$B$,e(B 0 e$B$Ge(B  
e$B$J$$$H$-!”$=$l$Oe(B T\_NONE e$B$G$O$J$$$O$:$G$7$g$&$+!#e(B

# Index: eval\_method.ci

— eval\_method.ci (revision 13485)  
+++ eval\_method.ci (working copy)  
@@ -72,6 +72,7 @@  
}  
}

+#include \<assert.h\>  
void  
rb\_clear\_cache\_by\_class(VALUE klass)  
{  
@@ -84,6 +85,7 @@  
ent = cache;  
end = ent + CACHE\_SIZE;  
while (ent \< end) {

- 

```
   if (ent->method) assert(TYPE(ent->method) != T_NONE);

```

if ((ent-\>klass == klass) ||  
(ent-\>method && ent-\>method-\>nd\_clss == klass)) {  
ent-\>mid = 0;

e$B0J2\<$N$h$&$K$9$l$P!"$=$NI=L@$r\<:GT$5$;$k$3$H$,$G$-$^$9!#e(B

% ./ruby -ve ’  
3.times {  
o = Object.new  
def o.a() end  
o.a  
GC.start  
}  
’  
ruby 1.9.0 (2007-09-22 patchlevel 0) [i686-linux]  
ruby: eval\_method.ci:88: rb\_clear\_cache\_by\_class: Assertion  
`rb\_type((VALUE)(ent-\>method)) != RUBY\_T\_NONE’ failed.
