Memory requirement of a program in java

Consider the class below, and notice the comment telling how much bytes they use. There is a overhead of 16bytes for maintaining class, 1 Byte for byte and boolean, 2Byte for char and short, 4 bytes for integer, 8 bytes for long and double, and some overhead for padding, to make overall memory even, to sum up: Java type Bytes required boolean 1 byte char 2 short int 4 float [Read More]

The stack and the heap

The memory a program uses is typically divided into four different areas: The code area, where the compiled program sits in memory. The globals area, where global variables are stored. The heap, where dynamically allocated variables are allocated from. The stack, where parameters and local variables are allocated from. There isn’t really much to say about the first two areas. The heap and the stack are where most of the interesting stuff takes place, and those are the two that will be the focus of this section. [Read More]

Memory Management Basics

Memory is central to the operation of a modern computer System. Memory consists of a large array of words or bytes each with its own address. The CPU fetches instructions from memory according to the value of the program counter. These instructions may cause additional loading from and storing to specific memory addresses. I have discussed a typical instruction-execution cycle in the previous article. In this article I will discuss on basic hardware issues, the binding of symbolic memory addresses to actual physical addresses and distinguishing between logical and physical addresses. [Read More]

Memory Management In C and C + +

For simple applications, it’s enough just to rely on automatic memory management through local variables. But once the data become larger, it is no longer imperative to request memory from the heap and manage. Content Function Families Allocators Toolbox Smart Pointer STL Containers A function families In principle, belong to the memory always two parts. First, an area of memory are requested, and second, the memory used at the end of the work be returned. [Read More]