Quantcast
Channel: Should we avoid object creation in Java? - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 15

Answer by AKS for Should we avoid object creation in Java?

$
0
0

I think your colleague must have said from the perspective of unnecessary object creation.I mean if you are creating the same object frequently then it is better to share that object.Even in cases where object creation is complex and takes more memory, you might want to clone that object and avoid creating that complex object creation process(But that depends on your requirement). I think the statement "Object creation is expensive" should be taken in context.

As far as JVM memory requirements are concerned, wait for Java 8, you don't even need to specify -Xmx, meta space settings will take care of JVM memory need and it will grow automatically.


Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>