Service shutdown frequently for version 4.2.1

Hi Team,

I have migrated to version 4.2.1 before a month and found critical issue after migration.

I have deployed one test server which may have only 10-15 users and 100 rosters for the server.

I have hosted openfire service on t2.micro instance of amazon aws server and altered heap memory for server to 512mb.

Now my service is killed by the server with the log attached below and the status is still showing as openfire server is running but it is already stopped and i could make connection with the server.

Log of service killed by OS

[935903.545354] Out of memory: Kill process 28117 (java) score 727 or sacrifice child
[935903.551783] Killed process 28117 (java) total-vm:2602052kB, anon-rss:736700kB, file-rss:0kB

anyone found the same reason for stopping the service by this type of situation then please help.

Thanks.