Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: avoiding OutOfMemoryException

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool avoiding OutOfMemoryException

    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.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: avoiding OutOfMemoryException

    See the following: http://www.javaprogrammingforums.com...html#post20021
    I presume this exception is happening client side, in which case adding the -xmx parameter would resolve the problem, but you should make sure the program doesn't hold onto references that are not necessary to avoid the exception in the first place.

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: avoiding OutOfMemoryException

    Quote Originally Posted by copeg View Post
    See the following: http://www.javaprogrammingforums.com...html#post20021
    I presume this exception is happening client side, in which case adding the -xmx parameter would resolve the problem, but you should make sure the program doesn't hold onto references that are not necessary to avoid the exception in the first place.
    I have tried that before only.But i cant get rid of that problem.Moreover the data that reads from the socket is not huge data.Its only number data.just Two numbers are read.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: avoiding OutOfMemoryException

    Hard to offer solutions without code to see what is happening. Can you make a SSCCE that demonstrates the problem?