Java and the memory

Java is a high-level language, which means that it is doing a lot of work for you. Nowadays, most languages do that (such as Scala, Go, and even recent C++ updates), but to understand the memory challenge, we need to go back to the early programming days and compare two simple code segments.

The first one is a simplified version of our provisioning service, directly taken from our quote manager application:

public void refresh() {    final Client client = ClientBuilder.newClient();    try {        final String[] symbols = getSymbols(client);        for (String symbol : symbols) {            final Data data = client.target(financialData)                        .resolveTemplate("symbol", symbol)                        .request(APPLICATION_JSON_TYPE)                        .get(Data.class);            quoteService.createOrUpdate(new ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.