Sponsored Links


Results 1 to 2 of 2

Thread: Request for Guidance in java 20111

  1. #1
    Senior Member saneha's Avatar
    Join Date
    Apr 2011
    Posts
    266

    Icon20 Request for Guidance in java 20111

    Sponsored Links1


    A.A. Sir! Thanks for replying. You have told me the following line of code to "java Xms10m Xmx250m MyApp" to set memory taken from heap. Please tell me how and where I can use in a Java project in NetBeans that on running project it automatically allocates enough memory and don't crash. Thank you.

    Sponsored Links

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578
    In Netbean , select the project , right click and select Properties.
    In properties select Run
    And add –Xmx256m in VM options. This will allocate 256 MB for your program.

    You can get the information regarding the Heap Memory using following code lines.

    // Get current size of heap in bytes
    long heapSize = Runtime.getRuntime().totalMemory();

    // Get maximum size of heap in bytes. The heap cannot grow beyond this size.
    // Any attempt will result in an OutOfMemoryException.
    long heapMaxSize = Runtime.getRuntime().maxMemory();

    // Get amount of free memory within the heap in bytes. This size will increase
    // after garbage collection and decrease as new objects are created.
    long heapFreeSize = Runtime.getRuntime().freeMemory();


    Note: You save some of your objects on disk and then use them back when needed. This way your code will be using less memo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. BlackBerry Torch 9810 preview and specfication 20111-12
    By Vuhelper in forum Virtual University Mobile's
    Replies: 0
    Last Post: 09-12-2011, 11:09 PM
  2. Replies: 0
    Last Post: 06-23-2011, 11:41 PM
  3. Replies: 1
    Last Post: 04-28-2011, 08:55 PM
  4. Replies: 0
    Last Post: 04-28-2011, 04:47 AM
  5. Replies: 0
    Last Post: 04-27-2011, 08:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft | Jobs