I have developed a project.It's based on client server architecture.the server is initiating properly.Client also connecting properly.But the problem is that server writes some data to the socket when client reads the data it generates an exception called "java.lang.outofmemoryexception:Java heap space".Moreover it generates this exception sometimes only not all times.How can I get rid of this exception.I am running my project through command prompt.