# Are there memory leaks in ElasticSearch's TransportClient 5.4.3 or is my code flawed?

**URL:** <https://discuss.elastic.co/t/are-there-memory-leaks-in-elasticsearchs-transportclient-5-4-3-or-is-my-code-flawed/91989>\
**Category:** Elasticsearch\
**Created:** [July 5, 2017, 9:51pm UTC](https://discuss.elastic.co/t/are-there-memory-leaks-in-elasticsearchs-transportclient-5-4-3-or-is-my-code-flawed/91989 "2017-07-05T21:51:28Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Thiago\_Sayao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago_sayao/32/20647_2.png) [@Thiago\_Sayao](https://discuss.elastic.co/u/Thiago_Sayao)\
**Post date:** [July 31, 2017, 7:48pm UTC](https://discuss.elastic.co/t/are-there-memory-leaks-in-elasticsearchs-transportclient-5-4-3-or-is-my-code-flawed/91989/5 "2017-07-31T19:48:41Z")

</div>

I have a similar code and it is also leaking. I am using 5.5.1.

It seems to be leaking byte arrays:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fd4330f224f98ceb0e6da91aa20987f36d204905.png)

The code looks like this:

```
try(PreBuiltTransportClient preBuiltTransportClient = new PreBuiltTransportClient(settings)) {
    try(TransportClient transportClient = preBuiltTransportClient.addTransportAddress(
            new InetSocketTransportAddress(InetAddress.getByName(endPoint), javaPort))) {
    
        populateIndex(transportClient, newIndexName, produtoService);
        reassignAlias(transportClient, newIndexName);
        cleanIndices(transportClient, newIndexName);
    }
    catch(IOException e) {
        logger.error(e.getMessage(), e);
    }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/are-there-memory-leaks-in-elasticsearchs-transportclient-5-4-3-or-is-my-code-flawed/91989)._
