CrazyEngineers
  • memory,objects,class relationships

    computeridiot007

    computeridiot007

    @computeridiot007-xUubel
    Updated: Oct 17, 2024
    Views: 943
    we know that memory is the basic requirement for all the things....even a variable occupy a memory in a space...my question is
    we know that objects and methods are present inside the class in java ...my question is how the memory will be allocated....whether the memory will be shared or there will be separate allocation....if it is how it will be mapping objects into a memory
    how it is done(with diagram) plz explain
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • gaurav.bhorkar

    MemberFeb 4, 2010

    Memory is generally allocated on stack and heap. It depends on your program and the compiler, is to how the memory allocation should be done.

    Remember, memory is not allocated by the compiler. The compiler just writes relative memory allocation table, the OS allocates memory at run-time.

    So, it also depends on your OS. Because it the stack is full, it will allocate memory at some other place.
    Are you sure? This action cannot be undone.
    Cancel
  • computeridiot007

    MemberFeb 4, 2010

    thanks for ur reply ...can u tell me on xp and windows 7 about this case and take turboc and devc++
    Are you sure? This action cannot be undone.
    Cancel
  • gaurav.bhorkar

    MemberFeb 4, 2010

    For C and C++ languages, memory allocation is done on the stack unless you specify it.
    Memory allocated using malloc () and new is always on heap.

    In newer languages like C# or python you are forced to allocate big objects on heap and small objects on stack.

    You must be knowing how much memory is allocated for int in 16 bit and in 32 bit.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register