LocalAlloc Vs GlobalAlloc Vs malloc Vs new

Excerpts from Raymond Chen’s OldNewThing Back in the days of 16-bit Windows, the difference was significant. In 16-bit Windows, memory was accessed through values called “selectors”, each of which could address up to 64K. There was a default selector called the “data selector”; operations on so-called “near pointers” were performed relative to the data selector. …

Read more

What do those strange class names in a java heap dump mean?

You’ll find the complete list documented under Class.getName(): If this class object represents a reference type that is not an array type then the binary name of the class is returned, as specified by the Java™ Language Specification, Second Edition. If this class object represents a primitive type or void, then the name returned is …

Read more

Class members and explicit stack/heap allocation

I think that you are confusing “stack/heap allocation” and “automatic variable”. Automatic variables are automatically destroyed when going out of context. Stack allocation is the fact that the memory is allocated on the execution stack. And variable allocated on the stack are automatic variables. Also, members are automatic variables whose destructors get called when its …

Read more

Heap vs Stack vs Perm Space

Simply Heap space: All live objects are allocated here. Stack space: Stores references to the object for variable in method call or variable instantiation. Perm space: Stores loaded classes information For example: Student std = new Student(); after executing the line above memory status will be like this. Heap: stores “new Student()” Stack: stores information …

Read more

Are global variables in C++ stored on the stack, heap or neither of them?

Here is what the book says on page 205: If you’re familiar with operating system architecture, you might be interested to know that local variables and function arguments are stored on the stack, while global and static variables are stored on the heap. This is definitely an error in the book. First, one should discuss …

Read more