rubyamf / rocketamf

52 stars 34 forks source link

Memory leaks fix for c ext #6

Closed qqshfox closed 12 years ago

qqshfox commented 12 years ago

I'm not a native english speaker, so... let's look at the code. :)

1) use st_free_table instead of xfree for ser->{str,trait,obj}_cache cleaning up; simple test case: 1_000_000.times {RocketAMF::serialize("abc", 3)}

2) xfree the str refs and trait refs which store in the {str,trait}_cache->key; simple test case: ser = RocketAMF::Serializer.new(RocketAMF::ClassMapper.new) 1_000_000.times {ser.serialize("abc", obj)} ser = nil

Thanks,

Hanfei

warhammerkid commented 12 years ago

Thanks so much for this. I had forgotten that I needed to free the keys that I added to the strtable.