Newbie question - variables and memory

I may be wrong, but I might have read somewhere that there’s a need to
delete variables from memory. In my web environment, can the same
variable or instance (@) variable retain the same value across multiple
requests, or was that about something else? (I know about session and
fom variables, and flashes, but I’m talking about regular variables or
instance variables) Thanks for your help and time.

Ben V. wrote:

I may be wrong, but I might have read somewhere that there’s a need to
delete variables from memory.

In normal usage, no. Ruby supports garbage collection, meaning that
memory allocated for objects no longer reachable will be reclaimed.

In my web environment, can the same
variable or instance (@) variable retain the same value across multiple
requests, or was that about something else? (I know about session and
fom variables, and flashes, but I’m talking about regular variables or
instance variables)

You are talking about two very different things. Here, I think you’re
digressing into CGI. And in that case, you should see the Sessions
section of this article: http://www.rubycentral.com/articles/cgi.html

Management of CGI session data is wholly distinct from Ruby’s
management of objects in general. Ruby the language knows nothing about
CGI, CGI sessions, or persistent data from those sessions. These are
implemented via the external CGI library.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs