Results 1 to 9 of 9
  1. #1
    sathishvegeta is offline Member
    Join Date
    Feb 2013
    Posts
    20
    Rep Power
    0

    Default Memory allocation of an OBJECT

    when we create an object memory allocation take place at compile time or runtime ? if so why ?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default Re: Memory allocation of an OBJECT

    Your program can only create an object when it is running, i.e. during runtime, so ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    sathishvegeta is offline Member
    Join Date
    Feb 2013
    Posts
    20
    Rep Power
    0

    Default Re: Memory allocation of an OBJECT

    Quote Originally Posted by JosAH View Post
    Your program can only create an object when it is running, i.e. during runtime, so ...

    kind regards,

    Jos
    Tks, for ur replay, what happens when it comes to method overloading?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default Re: Memory allocation of an OBJECT

    Quote Originally Posted by sathishvegeta View Post
    Tks, for ur replay, what happens when it comes to method overloading?
    What does that have to do with it?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    sathishvegeta is offline Member
    Join Date
    Feb 2013
    Posts
    20
    Rep Power
    0

    Default Memory allocation

    I wanna know that when does a memory allocation take place for variable,object,integer etc while in compile time or runtime ?
    if so can anyone please give the reason for that ???

  6. #6
    sathishvegeta is offline Member
    Join Date
    Feb 2013
    Posts
    20
    Rep Power
    0

    Default Re: Memory allocation of an OBJECT

    Quote Originally Posted by JosAH View Post
    What does that have to do with it?

    kind regards,

    Jos
    Sry, its not overloading..... What happens to static binding during the runtime weather it allocates memory at runtime or compile time to an object??

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,796
    Rep Power
    19

    Default Re: Memory allocation

    How is this any different to your other question?
    Jos answered it.
    Memory is not allocated until runtime, since the JVM does not run until runtime, so cannot request memory from the OS.

    Maybe you could explain how, exactly, memory could be allocated at compile time?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default Re: Memory allocation of an OBJECT

    Quote Originally Posted by sathishvegeta View Post
    Sry, its not overloading..... What happens to static binding during the runtime weather it allocates memory at runtime or compile time to an object??
    I don't think your questions make sense. Nothing is allocated during compile time on behalf of your program. The compiler alloctes stuff but that is needed for the compile job. During runtime, classes are loaded dynamically (implying lazy binding) and all allocation your program performs also happens during runtime.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default Re: Memory allocation of an OBJECT

    @OP: I merged your two threads; don't open more than one thread for the same question.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Huge memory allocation
    By mctommek in forum Advanced Java
    Replies: 2
    Last Post: 12-08-2011, 01:06 PM
  2. Memory Allocation
    By nathey in forum New To Java
    Replies: 1
    Last Post: 07-18-2011, 03:48 AM
  3. JNI Memory Allocation
    By Smokin' Caterpillar in forum Advanced Java
    Replies: 3
    Last Post: 09-16-2010, 05:00 PM
  4. Memory Allocation
    By zzpprk in forum Advanced Java
    Replies: 2
    Last Post: 03-16-2010, 01:14 AM
  5. Memory Allocation
    By kishan in forum New To Java
    Replies: 3
    Last Post: 09-19-2009, 05:47 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
  •