memory usage in java

Discussion in 'Java' started by Bala, Jul 28, 2003.

  1. Bala

    Bala Guest

    Java doesn't access memory from the local libraries, where as C and
    C++ do that. why is that?
     
    Bala, Jul 28, 2003
    #1
    1. Advertising

  2. On 27 Jul 2003 17:23:16 -0700, (Bala) wrote:

    > Java doesn't access memory from the local libraries, where as C and
    > C++ do that. why is that?


    Not sure what you mean by memory from local libraries. If
    you mean malloc() and such, in fact it does, but most of
    the large memory allocations of the JVM are done using
    some form of OS memory allocation routine, which is all
    malloc() and its brethren use. The exact routines called
    depend on OS and JVM implementation.

    The JVM usually makes an initial large memory allocation,
    called the Java heap. Code in Java that allocates objects
    will have these objects created in the heap and managed by
    the JVM. The heap is grown at need up to set limits (see
    the -Xms and -Xmx startup parameters for more info on
    controlling the size of the Java heap).

    --Joe
     
    Joseph Millar, Jul 28, 2003
    #2
    1. Advertising

  3. Bala

    Roedy Green Guest

    On 27 Jul 2003 17:23:16 -0700, (Bala) wrote or
    quoted :

    >Java doesn't access memory from the local libraries, where as C and
    >C++ do that. why is that?


    Java has its own memory allocation system that scavenges unused
    objects. C/C++ requires the programmer to carefully free unused
    objects. In practice he never gets all of them. They are two many
    exception paths. See http://mindprod.com/jgloss/reference.html


    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Jul 29, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. metfan
    Replies:
    2
    Views:
    4,854
    Robert Olofsson
    Oct 21, 2003
  2. hvt
    Replies:
    0
    Views:
    1,215
  3. hvt
    Replies:
    0
    Views:
    1,477
  4. Krist
    Replies:
    8
    Views:
    6,506
    Arne Vajhøj
    Feb 10, 2010
  5. MrsEntity
    Replies:
    20
    Views:
    482
Loading...

Share This Page