I
I
Ilya2014-01-25 21:51:00
Java
Ilya, 2014-01-25 21:51:00

How to allocate memory in Java?

The question may be stupid, but somehow I couldn’t formulate it particularly, and I didn’t find anything on Google. There is a times
function :

String where = "name = '"+ comboBoxEmployers.getSelectedItem().toString() +"'";
Employer emp = Employer.Find(database.getCursor(), where);
String id = emp.getValue("id").toString();
return new DBInteger(Integer.parseInt(id));

There is a function two (the same as once , only here everything is on the heap):
return new DBInteger(Integer.parseInt(Employer.Find(database.getCursor(), "name = '"+ comboBoxEmployers.getSelectedItem().toString() +"'").getValue("id").toString()));

Which of the functions will "eat" less memory (of course, I understand that the scale is wildly small, but still)? Well, that is, in function two, the memory will be allocated locally and, in fact, after exiting the function, the GC will clean it up, or exactly the same thing will happen in the function once?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FoxInSox, 2014-01-25
@rpsv

No difference.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question