Questions tagged [memory]

Memory refers to the physical devices used to store programs or data on a temporary or permanent basis for use in a computer or other digital electronic device.

Filter by
Sorted by
Tagged with
-3
votes
1answer
50 views

How to sync chunks of memory data across multiple computers [closed]

Multiple computers are connected via WAN (Internet or VPN). For example, there are 3 computers A, B and C. Each of them produces data a, b and c. The data is represented as memory chunks char[]. In my ...
0
votes
0answers
35 views

C++: Allocating a large multidimensional vector causes memory "overshoot" [migrated]

I observed an unexpected behavior when using a large multidmensional std::vector variable. In particular, when I allocate a 4-dimensional vector of large size, it can be seen, using a memory profiler, ...
0
votes
1answer
77 views

Is it possible for the CPU to read or write to the cache, while I/O device is reading main memory?

If an I/O device is reading the main memory (directly) then is it possible for the CPU to access the cache? I think it's possible for the CPU to access the cache in case of a hit. But in case of a ...
1
vote
3answers
248 views

Can more than one memory address be accessed at one time?

Apologies if this isn't the correct place to ask the question. But, I'm stumped. Can multiple memory addresses be read/written at one time, or must one address be read then another, is it possible for ...
0
votes
1answer
60 views

How do custom allocators know which addresses of memory they can allocate?

I was looking at Rust's Allocator trait. From my understanding, you give an allocator a length of memory and a word size to align to, and the allocator either gives you a pointer to the memory or an ...
8
votes
4answers
567 views

Why does the C++ standard still allow uninitialized primitive variables?

If reading uninitialized memory is undefined behavior anyway, why has the C++ standard not been changed so that objects of primitive type (int, unsigned, float, double, bool, char) get default-...
8
votes
5answers
3k views

How Are RAM Memory Addresses Determined

How are physical memory addresses actually determined or 'created'. What is the process where the byte blocks have a memory address assigned to it? I understand that this is determined during boot up, ...
5
votes
2answers
372 views

What happens to the rest of memory address space if the data is less than 1 byte?

Sorry if this sounds like a stupid question I’m very new to this. So my question is; within modern computers memory address space is a byte long, so what would happen to the rest of the address space ...
1
vote
4answers
853 views

C++: Is a pointer to a vector going to cause memory issues?

I started to write a function which had a pointer to a vector as a parameter so that it could modify that vector to output results (as the actual return value was an error code), when I started to ...
3
votes
2answers
336 views

How to read all the memory of another process in windows?

The title really says it all, I want to have all the readable memory of another process in a buffer. I understand that I will have to use ReadProcessMemory(), but If I'm correct I can't just use one ...
2
votes
1answer
189 views

In C++, If a member function can be made static with no change to functionality, are there any performance or memory benefits from doing so?

A very straightforward question. When I think about many of the member functions I create for my classes, many of them can be made static without affecting any functionality whatsoever. If I do so; ...
4
votes
2answers
104 views

Do coherence and transactional isolation mean the same?

About coherence vs consistency, https://en.wikipedia.org/wiki/Consistency_model says Coherence deals with maintaining a global order in which writes to a single location or single variable are seen ...
0
votes
2answers
145 views

What are the differences between memory coherence and cache coherence?

https://en.wikipedia.org/wiki/Memory_coherence says: Memory coherence is an issue that affects the design of computer systems in which two or more processors or cores share a common area of memory.[1]...
1
vote
3answers
225 views

How do binary numbers interact with the CPU and cause some action to take place? [duplicate]

EDIT: Perhaps what I am misunderstanding is that when it is said that the code we type gets turned into machine code of 0s and 1s. If these 0s and 1s are the abstracted representation of their ...
-2
votes
1answer
87 views

How to manually delete a std::vector in c++? [closed]

I have following code snippet void func(int row,int n,std::vector<int>& buffer){ if(row>n){ return; } std::vector<int> new_buffer; for(int elm : buffer){ ...
1
vote
1answer
53 views

is the relocatable machine code essentially the text segment of the virtual address?

Sorry if this is a basic question, I'm studying for my operating systems class and compiler theory class at the same time and this is confusing me. From what I do understand, virtual memory is larger ...
2
votes
2answers
156 views

Can the operating system "break up" a memory allocation (Linux)?

Let's say a process (P1) is asking for 100 MB of memory, and the RAM looks like this: [[50 MB free] [USED] [60 MB free] [USED]] Since there are technically enough memory that are available (110MB ...
-5
votes
2answers
110 views

How can you call a function from within a constructor when the contractor is defined before he function definition?

I have gone through multiple posts but am unable to find an answer to my very basic question on classes and so asking it here, it would be great if someone could shed some light on this topic- I have ...
2
votes
5answers
2k views

Do all threads share the same instance of a heap variable, or have different instances of a heap variable? [closed]

Computer Systems: a Programmer's Perspective says: 12.4.2 Mapping Variables to Memory Variables in threaded C programs are mapped to virtual memory according to their storage classes: Global ...
1
vote
2answers
442 views

How is it that reference counting is faster on Apple silicon Intel translation than on Intel?

I can't find the exact tweet, but it was stated by Apple engineers that the retain and release operations are faster on Intel x86 translation than on standard Intel x86.
0
votes
2answers
160 views

Cases of memory management where it is reasonable to separate program into several execs

I have 5000+ strings pet-project for CLI and it can do some optional calculations and can output results to CLI or/and to file. Some new modules don't work. Now I catch with GDB some strange segfaults ...
2
votes
1answer
136 views

How do these two ways of enforcing alignment work together?

In Computer Systems: a Programmer's Perspective, Alignment is enforced by making sure that every data type is organized and allocated in such a way that every object within the type satisfies its ...
-2
votes
1answer
51 views

Does this alignment of structure objects apply only to structure objects being used as elements of an array?

In Computer Systems: a Programmer's Perspective, In addition, the compiler may need to add padding to the end of the structure so that each element in an array of structures will satisfy its ...
-1
votes
3answers
122 views

Is an assembly program a procedure itself and does it occupy a stack frame?

If I am correct, an assembly language uses the program stack to store data. Is it correct that the program stack is partitioned to frames, each of which is for a call to a procedure? So there is no ...
-2
votes
1answer
113 views

What memory cleaner software exactly do? [closed]

You must have seen them as applications on mobile devices and I've been using one on mac OS. I was wondering what exactly memory cleaner software do? Do they free up memory in both ROM and RAM? And ...
-4
votes
1answer
58 views

How to Handle Out of memory?

We are developing a mobile app where consumers (companies) create AR content for their products. The content ranges from simple pictures to gifs and embedded videos. We already released versions ...
0
votes
1answer
97 views

Which scope should markers for a Stack Allocator fall under?

For reference, I am reading from "Game Engine Architecture 2nd Edition" by Jason Gregory. Although I understand the theory behind Stack Allocators, I am having trouble implementing it fully. ...
1
vote
1answer
179 views

How can I do memory management in C++ when a class needs to throw out and replace a member object many times during its lifetime?

I'm writing a C++ application. This is a memory management question, I have a background in scripting languages and am new to C++. I have a little class representing a GUI view, call it View, and ...
0
votes
3answers
161 views

What goes into a computer deciding how many memory locations to assign for specific data types in C?

I have learned file memory management and some very simple CPU assembly for manual memory manipulation. Still, I feel like there is a gap in my knowledge when it comes to modern, complex computers, ...
1
vote
2answers
133 views

How do I defragment memory blocks that are not logically adjacent?

I have an explicit free list. Each node contains the number of blocks it manages. When you allocate, the memory manager returns the first block of the managed blocks. In the beginning, there is only ...
1
vote
1answer
98 views

When modules written in different languages interact, is exchanged data always serialized?

I have module written in Python and I would like to write function in e.g. Go but problem is that data needed for computations is often more than 100MB. My question is: is data always serialized and ...
-4
votes
1answer
106 views

Where on the 64bit memory of a PC would one byte end up?

I have a simple question I think. A typical pc with ram has a 64bit databus between the cpu and ram. Let's say the ram starts at address 0, and I write i byte to address 0. Now my question is, would ...
-2
votes
1answer
91 views

Trick or technique to allocating variables given only one "memory store"?

I have a problem where I am using a Uint32Array in JavaScript as a store: const store = new Uint32Array(1 << 16) I am going to use this store like a runtime environment. Basically, everything ...
-4
votes
1answer
76 views

Using only the Cache not the DRAM in a Program (USB to Ethernet) [closed]

I am reading some data from USB, do some packet processing and then send the result to the Ethernet port. The USB ports are connected to an onboard USB Hub where it communicates with the ...
-1
votes
1answer
218 views

Do other languages have variables shared between threads?

I guess it would be too complex for Node.js / JavaScript to leverage, but I've been working with clusters in node to break big tasks down so all cores can work at once but the inter-process messaging ...
-3
votes
2answers
39 views

Passing different sized parameters cost savings

I was wondering if there is some cost saving, either in time or space by passing and/or returning smaller arguments? char vs int. I have heard the compiler will optimize the code based on the type of ...
0
votes
1answer
108 views

How should I provide generic typing and allocation for a collection library in C?

I am in the process of implementing a persistent collection in C, specifically, an immutable hash trie. In order to increase acceptance and reusability, I have identified the following key areas that ...
3
votes
7answers
1k views

Is it possible to update exactly 1 byte in RAM?

For example I have a static C++ array {'d', 'o', 'c', 's'}. And I have x86 architecture, with 32-bits length words. I want to replace letter c with g. As far as I understand, when we make a read ...
4
votes
4answers
264 views

How is memory unsafety generated, found, exploited and fixed?

I'm not a low-level programmer, I mainly program in C# which is a managed language. Still, every now and then I read articles, news and patch notes about the most varied software talking about memory ...
-2
votes
1answer
442 views

In C++ and GCC on Linux, is it possible to allocate memory to your swap space instead of your RAM?

I have a large hash, around 6 gigabytes that I load into memory. On my current laptop that I develop from, it really does a number on my system, causing massive amounts of lag while I try to go about ...
-2
votes
2answers
616 views

Why is FLASH memory considered "Read Only" by definition?

Why are FLASH memories considered to be EEPROMS? EEPROM has "Read Only" in its name, so by definition you cannot rewrite it, yet FLASH memories are used for USBs and many other technologies which are ...
-1
votes
2answers
125 views

Developing a C++ program on linux using two threads, always keeping one thread running

The title describes an idea of a solution to a more general problem. Here is the general problem: I am developing a program which looks roughly as follows: [read a lot of data, store in data ...
2
votes
1answer
67 views

Storing and filtering spatial data within RAM

I'm trying to figure out what's the proper way of storing and filtering spatial data inside a running program. I have a 2D map of theoretically infinite size. Users generate objects which are placed ...
-2
votes
1answer
99 views

Does accessing RAM from 2 threads double access time (synchronous access)?

As in topic. If i want to access RAM from 2 different threads, completly different cells in memory, do they queue and are sent asynchronously or queue? Lets say accessing memory from one thread (...
1
vote
1answer
977 views

How do I store a trie in memory in a Spring Boot Application?

I have a spring boot application, that simply does, takes a set of characters and lists out possible english words. Now, as everyone knows , its fairly easy, build a trie data-structure to load up a ...
2
votes
1answer
3k views

Storage of global variables

In C, global variables are stored with the program code. I.e. the space to hold them is part of the object file (either in the data or bss section), instead of being allocated during execution (to ...
38
votes
10answers
12k views

What's the difference between a variable and a memory location? [closed]

Recently I've been trying to explain pointers in a visual way, as flashcards. Question 001: This is the drawing of a location in computer memory. Is it true that its address is 0x23452? Why? ...
0
votes
1answer
145 views

How swap space works in this example?

Say I have total RAM memory of 1GB , HD of 10 GB with 250 MB swap space Say I have two files(f1 and f2) each of 500 MB opened on my my laptop. Now both files are in memory and have consumed 1 GB of ...
1
vote
4answers
221 views

Why do some VMs manage their own memory instead of relying fully on the system allocator?

As far as I know, most "serious" VM implementations, such as CPython and the Oracle JVM, do not request new memory from the operating system ("malloc()") each time they create a new object. As far as ...
2
votes
2answers
354 views

Memory Allocation in C++

Does the memory allocated by class pointers get freed by the class destructor once the class method/function goes out of scope? Or do I need to manually free the memory allocated by the pointer (C++). ...

1
2 3 4 5 6