• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

local variable and performance issue of server  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should we restrict ourselves to define as less number of local variables of primitive and String types as possible? What is the impact of memory if we define large number of local variables? What is the load of these variables in Web servers in terms of space and time complexity, if we define them in servlets etc? Should we nullify them after use?
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Variable scope will not affect time complexity if you access them anyway. As for memory, the killers are usually when a leak happens or one of these examples

1. DOM parses huge XML
2. Entire files are read instead of streaming them with buffers
3. Byte [] buffers are saved and their references are held indefinitely
etc etc

Do you have a specific memory leak / performance problem ? And by the way, defining member variables in a servlet is a bad idea.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!