#define_method
will create a closure, without careful use it could cause memory leak, as pointed out here.
OpenStruct
use #define_method
to create accessors dynamically, we suspect that will cause memory leak.
So I create two scripts to prove it, however the result shows the opposite: OpenStruct
doesn't leak memory.