Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

-XX:DefaultMaxRAMFraction=VALUE

843829Jan 23 2007 — edited Feb 6 2007
Sun's 1.5 JVM has some heap size configuration parameters that are not
available in their 1.4 and earlier JVMs.

For Sun's 1.5 JVM (not 1.4), there is the following documentation on
sun's website:
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html#0.0.0.0.%20Heap%20Size%7Coutline


If not otherwise set on the command line, the sizes of the initial
heap and maximum heap are calculated based on the size of the physical
memory. If phys_mem is the size of the physical memory on the
platform, the initial heap size will be set to phys_mem /
DefaultInitialRAMFraction. DefaultInitialRAMFraction is a command line
option with a default value of 64.
Similarly the maximum heap size will be set to phys_mem /
DefaultMaxRAM.
DefaultMaxRAMFraction has a default value of 4.
<end of fragment>


Does the second to the last line, in the above fragment, have a typo?
Shouldn't it read:
"Similarly the maximum heap size will be set to phys_mem /
DefaultMaxRAMFraction"


------------


I am thinking it's a typo because I just looked at:


http://java.sun.com/developer/JDCTechTips/2005/tt0216.html


You can further control the heap size through the following new
options:


-XX:DefaultInitialRAMFraction=VALUE
-XX:DefaultMaxRAM=VALUE
-XX:DefaultMaxRAMFraction=VALUE


DefaultInitialRAMFraction has a default value of 64.
DefaultMaxRAMFraction has a default value of 4. The default initial
size of the heap is the size of physical RAM divided by
DefaultInitialRAMFraction. You can either set the maximum size
explicitly with DefaultMaxRAM
or use DefaultMaxRAMFraction to set the value proportionally.


------


Also, why did they create the "-XX:DefaultMaxRAM" option, when there is
already the
"-Xmx" option that is available in 1.5 (and was also available in
earlier JVMs) ? I can see the reason for the
"-XX:DefaultInitialRAMFraction" and the "-XX:DefaultMaxRAMFraction"
options, but the "XX:DefaultMaxRAM" option seems redundant with the
"-Xmx" option.


You would think there would be better documentation of these options.

Comments

John Snyders-Oracle
Answer

Hi,

This is an unusual use case; expand all the nodes up to a given node. You say that by default all nodes are expanded but I don't know of any option to do that. You must be doing something on page load to expand all the nodes. Perhaps you use the DA action Expand Tree.

I assume you already have a way to set the Selected Node Page Item.

Add the following to the tree region JavaScript Initialization Code attribute:

function(options) {

    // traverse the tree data gathering nodes to expand up to a given id

    function traverse( expandNodes, n, stopId ) {

        var i, stop;

        if ( n.id === stopId ) {

            return true;

        }

        if ( n.children ) {

            // if it has children then it is something that can be expanded

            expandNodes.push( n.id );

            for ( i = 0; i < n.children.length; i++ ) {

                stop = traverse( expandNodes, n.children[i], stopId );

                if ( stop ) {

                    return stop;

                }

            }

        }

        return false;

    }

    options.makeNodeAdapter = function(data, types, hasIdentity) {

        var a, expandedIds = [];

        traverse(expandedIds, data, $v("P10_SELECTED_NODE")); // change this to match your page item that holds the selected node id

        a = $.apex.treeView.makeDefaultNodeAdapter( data, types, hasIdentity, expandedIds );

        return a;

    }

    return options;

}

Regards,
-John

Marked as Answer by Prashanth Raju-Oracle · Jul 23 2019
Prashanth Raju-Oracle

Thanks @"John Snyders-Oracle"  for the code. Yes, I was using an Dynamic Action to expand the tree nodes on page load. I have disabled it after adding your code.

It works perfectly fine. It expands all the nodes up to a given node. But the code does not expand the given node by itself. I mean if there are any child nodes for P10_SELECTED_NODE then it will still be in collapsed state. How can I modify the code to expand the selected node (ex: P10_SELECTED_NODE) as well?

Thanks in advance.

John Snyders-Oracle

I think just move the exit test to after the recursion.

so:

    // traverse the tree data gathering nodes to expand up to a given id

    function traverse( expandNodes, n, stopId ) {

        var i, stop;

        if ( n.children ) {

            // if it has children then it is something that can be expanded

            expandNodes.push( n.id );

            for ( i = 0; i < n.children.length; i++ ) {

                stop = traverse( expandNodes, n.children[i], stopId );

                if ( stop ) {

                    return stop;

                }

            }

        }

        return n.id === stopId;

    }

Prashanth Raju-Oracle

@"John Snyders-Oracle",

Thanks a ton for your quick response. It worked.

Prashanth Raju-Oracle

@"John Snyders-Oracle",

Sorry to trouble you again. I have a slight change in my requirement which was mentioned in my initial post.

I have to expand only the Selected Nodes parent and its child's (if any). Rest of the tree nodes must be collapsed.

I tried modifying the code which you sent earlier to satisfy my new requirement but I am unable to get to my requirement.

Can you let me know the code snippet to to satisfy this requirement?

Below is my Tree with All node expanded. this show root node with its children:

tree_expanded.png

Below is my Tree with only Selected Node and its child expanded. Rest of the nodes are collapsed:

Tree_New.png

Thanks in advance.

Prashanth Raju-Oracle

@"John Snyders-Oracle"

Below are the updated Screenshots. Screenshots above is not showing the correct Selected Node:

Tree with All nodes expanded and selected nodes highlighted:

tree_expanded.png

Tree only selected node and its children expanded:

Tree_New.png

GPGRIMES2

What I'm trying to do what is probably very simple. I want to add code to expand nodes below current node if the current node is double clicked. I want stop expanding when the node is at the same level as the node which was double clicked. For example:
Entity: abc
Sub-Entity: def
Program Group: ghi
Program: jkl
Program: jkl2
Program Group: mno
Program: pqr
Program: pqr2
Sub-Entity: tuv
...
Entity: wxy
...
If I double click on, Entity: abc, then all nodes under this node, are expanded but stop at Entity: wxy. If I double click on Program Group: ghi, then Program nodes: jkl and jkl2 are expanded. Note: There could be more levels below Program level. Also, some levels make not exist, i.e. you could have a Sub-Entity but no children levels below that.
Any assistance would be greatly appreciated.
Thanks.

1 - 7
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 6 2007
Added on Jan 23 2007
2 comments
1,661 views