Getting java.lang.OutOfMemoryError: Java heap space when you use Spring Kafka to generate a message

I am trying to implement a Spring Boot application in Pivotal Cloud Foundry to use Spring Kafka to send a message to Kafka and get an error below 1GB of memory in manifest.yml. My Sprint boot application only has a rest controller with a single endpoint to send a message. The application starts without any problem if I change the memory to 2GB in my manifest.yml and almost 1.3 GB – 1.8 GB are needed to run the application. I wonder why this simple application is taking so much memory. Is it because of Kafka?
In our application, we are using org.apache.kafka.clients.admin.KafkaAdminClient

We are using Spring 2.x, java 8 and buildpack 3.9 with this application.

[APP/PROC/WEB/0] OUT # java.lang.OutOfMemoryError: Java heap space
{APP / PROC / WEB / 0]OUT # -XX: OnOutOfMemoryError = "/ home / vcap / app / .java-buildpack / open_jdk_jre / bin / killjava.sh"

Any help to understand this problem would be greatly appreciated.