Memory access is a generic term that is used to represent the action of a computing unit accessing data.
Questions tagged [memory-access]
153 questions
268
votes
6 answers
Can I set a breakpoint on 'memory access' in GDB?
I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see…

TJ Seabrooks
- 20,203
- 6
- 33
- 30
99
votes
4 answers
In CUDA, what is memory coalescing, and how is it achieved?
What is "coalesced" in CUDA global memory transaction? I couldn't understand even after going through my CUDA guide. How to do it? In CUDA programming guide matrix example, accessing the matrix row by row is called "coalesced" or col.. by col.. is…

kar
- 2,505
- 9
- 30
- 32
76
votes
8 answers
What is the Cost of an L1 Cache Miss?
Edit: For reference purposes (if anyone stumbles across this question), Igor Ostrovsky wrote a great post about cache misses. It discusses several different issues and shows example numbers. End Edit
I did some testing and…

Mark Wilkins
- 40,729
- 5
- 57
- 110
67
votes
14 answers
Efficiency: arrays vs pointers
Memory access through pointers is said to be more efficient than memory access through an array. I am learning C and the above is stated in K&R. Specifically they say
Any operation that can be achieved by array subscripting can also be done with…

Abhijith Madhav
- 2,748
- 5
- 33
- 44
35
votes
5 answers
Using the extra 16 bits in 64-bit pointers
I read that a 64-bit machine actually uses only 48 bits of address (specifically, I'm using Intel core i7).
I would expect that the extra 16 bits (bits 48-63) are irrelevant for the address, and would be ignored. But when I try to access such an…

user2316720
- 361
- 1
- 3
- 3
15
votes
1 answer
How can the L1, L2, L3 CPU caches be turned off on modern x86/amd64 chips?
Every modern high-performance CPU of the x86/x86_64 architecture has some hierarchy of data caches: L1, L2, and sometimes L3 (and L4 in very rare cases), and data loaded from/to main RAM is cached in some of them.
Sometimes the programmer may want…

osgx
- 90,338
- 53
- 357
- 513
15
votes
1 answer
Read Random Memory Locations with Golang
Good evening,
I've been trying to build a golang application which scans values in memory but am struggling trying to understand how to address specific memory locations. I know that when accessing memory within the application you can use…

kkirsche
- 1,217
- 2
- 15
- 38
13
votes
3 answers
What happens if two threads read & write the same piece of memory
It's my understanding that if two threads are reading from the same piece of memory, and no thread is writing to that memory, then the operation is safe. However, I'm not sure what happens if one thread is reading and the other is writing. What…

cheshirekow
- 4,797
- 6
- 43
- 47
13
votes
2 answers
Why am I getting this memory access error 'double free or corruption'?
I am getting the following type of error. I know it has something to do with me improperly accessing memory, but I don't exactly how. Please help me see where I have gone wrong.
*note I have simplified my function and it is not obvious what the…

spatara
- 893
- 4
- 15
- 28
12
votes
2 answers
How can I handle DLL errors in VBA?
The API declaration:
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal HWnd As Long, _
ByVal msg As…

Greedo
- 4,967
- 2
- 30
- 78
11
votes
3 answers
Calculating average memory access time in a system implementing cache memory
In order to find avg memory access time we have the formula :
Tavg = h*Tc +(1-h)*M
where h = hit rate
(1-h) = miss rate
Tc = time to access information from cache
M = miss penalty (time to access main memory)
I…

Sreekanth
- 111
- 1
- 1
- 3
11
votes
1 answer
How to optimize OpenCL code for neighbors accessing?
Edit: Proposed solutions results are added at the end of the question.
I'm starting to program with OpenCL, and I have created a naive implementation of my problem.
The theory is: I have a 3D grid of elements, where each elements has a bunch of…

Alex
- 1,449
- 4
- 18
- 28
10
votes
1 answer
Solidworks, tracking down a Memory Access Violation Error on Isldworks.CloseDoc
I have two different functions inside an addon I have been working on in C#. Recently (Apparently) Solidworks has been crashing when it gets to certain parts of these two functions (possibly more, but these are the only two I have found it occurring…

Nick
- 665
- 5
- 12
9
votes
3 answers
How are variables on the stack accessed?
Suppose we have these local variables:
int a = 0;
int b = 1;
int c = 2;
int d = 3;
As far as I know, these will be allocated on the system stack, like this:
| |
| 3 | d
| 2 | c
| 1 | b
|_0_| a
Does this mean that in order to get the value of a,…

neo2862
- 1,496
- 1
- 13
- 27
9
votes
5 answers
How to optimize memory access pattern / cache misses for this array decimate/downsample program?
I was recently asked about a piece of code to decimate/downsample the array "in-place". This "decimation" function takes an array of ints and stores an entry at an even index i in the array at the index i/2. It does it for all entries in the…

Joe Black
- 625
- 6
- 19