symbols in ruby

Symbols are good way to save memory,What's that mean?. When object is created each time in ruby it is allocated with a memory,when we instantiate same object again and again it will also create a additional new memory.But symbols don't lets look in to a example

When ever we instantiated the same object in each time the object_id of that string object gives different memory locations but in case of symbols memory location are same.Thats means symbols can hold the same for each call but string cannot.

No comments:

Post a Comment


installing perl dancer in ubuntu

For installing perl dancer you need curl utility for installing curl ,   sudo apt-get install curl Now we can install Perl-Dancer by thi...