memory-layout Questions
3
Solved
I'm defining structs to be received and sent over a communication channel between different devices and different programming languages.
For that I explicitly define their layout in memory using St...
Heer asked 12/2, 2015 at 21:25
1
Solved
Of course, the answer is "no", because the people who wrote it thought really hard about it, however I want to know why.
Considering that (template-less) classes are often declared in header files...
Manor asked 23/10, 2014 at 13:58
3
I am looking into to the memory layout of a given process. I notice that the starting memory location of each process is not 0. On this website, TEXT starts at 0x08048000. One reason can be t...
Lonni asked 9/10, 2014 at 7:35
1
Solved
It is clear from the reference manual that the memory layout of structs is unspecified (when the repr attribute is not used). This rule gives the compiler the possibility to pack structures tighter...
Mills asked 3/9, 2014 at 17:15
5
Solved
As a programming exercise, I am writing a mark-and-sweep garbage collector in C. I wish to scan the data segment (globals, etc.) for pointers to allocated memory, but I don't know how to get the ra...
Seignior asked 29/11, 2010 at 23:3
2
Solved
Coming from a background of C/C++, memory layout of objects with regards to reducing cache misses is something that is crucial especially when working on consoles. Data-oriented design is oft...
Extrorse asked 30/7, 2014 at 15:46
2
Solved
Consider following hierarchy:
struct A {
int a;
A() { f(0); }
A(int i) { f(i); }
virtual void f(int i) { cout << i; }
};
struct B1 : virtual A {
int b1;
B1(int i) : A(i) { f(i); }
vi...
Metallist asked 22/7, 2012 at 19:7
2
Solved
I'm experimenting with optimizing parser combinators in C#. One possible optimization, when the serialized format matches the in-memory format, is to just do an (unsafe) memcpy of the data to be pa...
Camden asked 7/7, 2013 at 7:13
2
Solved
I am trying to understand the stack frame in C, so I wrote a simple C code to analyze the stack frame.
First of all the fun1() returns an address of a local variable which is initialized to 10 t...
Doited asked 25/4, 2014 at 5:27
2
Solved
It seems that on Windows 32 bit, kernel will reserve 1G of virtual memory from the totally 4G user virtual memory space and map some of the kernel space into this 1G space.
So my questions are:
...
Nativeborn asked 26/12, 2013 at 22:36
2
Solved
I was wondering about a possible way to make memory layout of a class to be more effective in templated code. As far as I know, Standard mandates data members of a class to be laid out in memory on...
Pebbly asked 24/9, 2013 at 7:9
2
Solved
In c/c++ (I am assuming they are the same in this regard), if I have the following:
struct S {
T a;
.
.
.
} s;
Is the following guaranteed to be true?
(void*)&s == (void*)&s.a;
Or...
Brusa asked 24/7, 2013 at 21:27
2
Solved
I am a bit confused on how a program looks like in memory , my professors told me that the stack and heap grow towards each other with the stack being at a lower memory address.
First thing that ...
Smoothshaven asked 14/7, 2013 at 0:37
2
Solved
When checking the disassembly of the object file through the readelf, I see the data and the bss segments contain the same offset address.
The data section will contain the initialized global and s...
Conglobate asked 15/5, 2013 at 5:42
2
Solved
If I have a class Base, with at least one virtual function, and a class Derived which inherits singly from this then (uintptr_t)derived - (uintptr_t)static_cast<Base*>(derived) is guaranteed ...
Europa asked 28/2, 2013 at 19:55
4
Solved
In one of the answers to the question "Regarding the bss segment and data segment in Unix", I see the explanation on bss as follows:
Bss is special: .bss objects don't take any space in ...
Osseous asked 9/10, 2012 at 10:52
2
Solved
How many vptrs are usually needed for a object whose clas( child ) has single inheritance with a base class which multiple inherits base1 and base2. What is the strategy for identifying how many vp...
Vitia asked 27/7, 2010 at 8:54
6
Solved
I have two classes - one base class and one derived from it :
class base {
int i ;
public :
virtual ~ base () { }
};
class derived : virtual public base { int j ; };
main()
{ cout <<...
Saffier asked 5/6, 2012 at 19:24
3
Solved
There is this code:
#include <iostream>
class Base
{
public:
Base() {
std::cout << "Base: " << this << std::endl;
}
int x;
int y;
int z;
};
class Derived : Base
{
p...
Bore asked 21/7, 2012 at 16:12
5
If I have two classes, one inheriting from the other, and the child class only containing functions, will the memory layout be the same for both classes?
e.g.
class Base {
int a,b,c;
};
class D...
Recital asked 9/7, 2012 at 22:36
1
Solved
Following up Why is the ELF execution entry point virtual address of the form 0x80xxxxx and not zero 0x0? and Why do virtual memory addresses for linux binaries start at 0x8048000?, why cannot I ma...
Barden asked 14/11, 2011 at 2:25
3
Solved
I have written several program and found out that when compiled in 64bit, the memory mapping segment (where for example shared objects and shared memory are kept) is always located somewhere around...
Orcein asked 11/10, 2011 at 16:2
1
Solved
This might be a duplicate question. I wish to know how the memory map of a windows process look like? I am looking for details. Kindly provide links to blogs, articles and other relevant literature...
Angers asked 15/4, 2011 at 18:19
5
Solved
I just learned about function pointers (pointers pointing at the adress where where the machine code of a function is stored). This made me think about machine code and how it is stored in memory. ...
Pedometer asked 22/2, 2011 at 23:39
3
Is there a way to print the layout of a C++ object using the g++ compiler or any other means.
A simplified example (assuming int takes 4 bytes)
class A{
int a;
};
class B:public A{
int b;
}
...
Pacemaker asked 5/6, 2010 at 7:49
© 2022 - 2024 — McMap. All rights reserved.