From: "rosenfeld (Rodrigo Rosenfeld Rosas)" Date: 2013-03-08T02:17:25+09:00 Subject: [ruby-core:53198] [ruby-trunk - Feature #7791] Let symbols be garbage collected Issue #7791 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). Of course the params are verified and there is no risk of SQL injection in my case either. I'm joining the same table multiple times at least once for each condition in the search query request that contains a reference to some field. The number of fields is limited by the ones existing in the database. To give you a concrete example, suppose we have to fields with ids 786 and 2048 and both are of type 'string'. So there is a table in the database called "string_value". I need to join the same table twice once for each field. The query will then generate the aliases v786 and v2048 to the same table in different joins. And the columns would be aliased "v786_value" and "v2048_value" for instance. It doesn't make any sense in my opinion that I should have to worry about memory starvation in my application just because Sequel will convert all my columns to symbols after running my dynamic queries. I don't want even to worry if they are symbols or strings, that's why I proposed th at other ticket to make symbols and strings behave the same. ---------------------------------------- Feature #7791: Let symbols be garbage collected https://bugs.ruby-lang.org/issues/7791#change-37366 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Feedback Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor Lots of Denial-of-Service security vulnerabilities exploited in Ruby programs rely on symbols not being collected by garbage collector. Ideally I'd prefer symbols and strings to behave exactly the same being just alternate ways of writing strings but I'll let this to another ticket. This one simply asks for symbols to be allowed to be garbage collected when low on memory. Maybe one could set up some up-limit memory constraints dedicated to storing symbols. That way, the most accessed symbols would remain in that memory region and the least used ones would be reclaimed when the memory for symbols is over and a new symbol is created. Or you could just allow symbols to be garbage collected any time. Any reasons why this would be a bad idea? Any performance benchmark demonstrating how using symbols instead of strings would make a real-world software perform much better? Currently I only see symbols slowing down processing because people don't want to worry about it and will often use something like ActiveSupport Hash#with_indifferent_access or some other method to convert a string to symbol or vice versa... -- http://bugs.ruby-lang.org/