Results 1 to 15 of 15
Like Tree1Likes
  • 1 Post By JosAH

Thread: Java Memory Layout

  1. #1
    Arun_N is offline Member
    Join Date
    May 2011
    Posts
    21
    Rep Power
    0

    Post Java Memory Layout

    How the variables and objects will be stored in java? can we use bit fields kind of concept in java? how to declare variables such that we can save memory?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Why? Do you have a specific problem?

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    can we use bit fields kind of concept in java?
    java.util.BitSet

    db

  4. #4
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Objects and variables already take up very little space, and with the standard amount of ram found in computers is 4-6 gigs of ram I doubt you will ever hit that mark.

    I don't really know why you need to save even more memory, unless maybe you're coding something major like an operating system or are coding into something very small.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Dark View Post
    Objects and variables already take up very little space,
    Not necessarily, it depends on what type of monster objects you create yourself (design questions ignored).
    and with the standard amount of ram found in computers is 4-6 gigs of ram I doubt you will ever hit that mark.
    Leaving out my previous comment, that depends, I have hit that mark a number of times, and that without and glaring "design questions".

    My opinion is, we should first find out why the OP wishes to know this. If it for simple academic purposes, then he should simply do some research, if he has a specific "case" then he should describe that so that he can be helped.

  6. #6
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    I'm curious as to what you made that took up 4-6 gigs of ram.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  7. #7
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Financial risk simulations for a very large bank over a ten year, quarterly timeframe, taking transfer risks into account.

  8. #8
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Ahh, well I don't think that would be run on an average computer.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by masijade View Post
    Financial risk simulations for a very large bank over a ten year, quarterly timeframe, taking transfer risks into account.
    Java Code:
    System.out.println((Math.rand() > 0.5)?"buy!":"sell!");
    kind regards,

    Jos ;-)
    sunde887 likes this.
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Is probably just as valid. ;-)

  11. #11
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by masijade View Post
    Is probably just as valid. ;-)
    Why do you think I posted it? ''serious" is my middle name especially after I read up on the bears and bulls and their silly dramatic interpretation of dual costs. I don't buy that crapola ;-)

    kind regards,

    Jos aka Self Fullfilling Prophesy
    cenosillicaphobia: the fear for an empty beer glass

  12. #12
    Arun_N is offline Member
    Join Date
    May 2011
    Posts
    21
    Rep Power
    0

    Default

    I just wanted to Know about granularity and Padding in Java.

  13. #13
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Them, As already Said, Research.

  14. #14
    Arun_N is offline Member
    Join Date
    May 2011
    Posts
    21
    Rep Power
    0

    Default

    can anyone one please give solution to my problem..........

  15. #15
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Arun_N View Post
    can anyone one please give solution to my problem..........
    This is what the JVM specification (read it!) has to say about your problem

    Quote Originally Posted by JVM Specification
    3.7 Representation of Objects

    The Java virtual machine does not mandate any particular internal structure for objects
    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. java on mac - gui layout problem
    By dalo in forum AWT / Swing
    Replies: 0
    Last Post: 06-19-2010, 11:15 AM
  2. Replies: 2
    Last Post: 08-21-2008, 08:33 PM
  3. Java GUI layout
    By nick2price in forum New To Java
    Replies: 2
    Last Post: 05-27-2008, 10:42 PM
  4. Use the Layout in java
    By lenny in forum AWT / Swing
    Replies: 2
    Last Post: 07-26-2007, 08:20 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
  •