Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
2 votes
4 answers
297 views

What are the trade-offs between garbage collection and Automatic Reference Counting?

By "Automatic Reference Counting", I am refering to the specific feature of the Clang compiler. By "Garbage Collection", I am refering to Tracing Garbage Collection, not to "...
user avatar
2 votes
4 answers
158 views

How to design around webapp Out of Memory crashing on export from SQL DB to Excel?

I have a monolith CRUD application with a feature - possibility to export some DB entires to an Excel file. The export is done within a background task. Often, however, when user presses the button ...
user avatar
  • 75
2 votes
1 answer
70 views

Should small overhead count towards an upper memory bound or rather be ignored?

I have a memory pool class that manages memory objects of fixed sizes, a bit like a primitive malloc() that can only return memory blocks of a few predefined sizes and unlike malloc() is guaranteed to ...
user avatar
  • 1,653
3 votes
4 answers
457 views

C# How to avoid memory leak in this case

I've got a Window, which gets a viewmodel instance injected into its constructor. The window sets its DataContext to that viewmodel. The viewmodel contains a command to "submit" the window ...
user avatar
0 votes
1 answer
81 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 ...
user avatar
  • 111
0 votes
3 answers
520 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 ...
user avatar
  • 184
0 votes
1 answer
66 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 ...
user avatar
  • 11
7 votes
4 answers
678 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-...
user avatar
8 votes
5 answers
4k 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, ...
user avatar
  • 184
5 votes
2 answers
455 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 ...
user avatar
  • 184
1 vote
4 answers
3k 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 ...
user avatar
3 votes
2 answers
873 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 ...
user avatar
3 votes
1 answer
543 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; ...
user avatar
  • 3,319
4 votes
2 answers
108 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 ...
user avatar
  • 5,271
0 votes
2 answers
241 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]...
user avatar
  • 5,271
1 vote
3 answers
443 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 ...
user avatar
  • 31
-2 votes
1 answer
119 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){ ...
user avatar
1 vote
1 answer
63 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 ...
user avatar
  • 163
2 votes
2 answers
162 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 ...
user avatar
  • 163
-5 votes
2 answers
278 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 ...
user avatar
2 votes
5 answers
3k 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 ...
user avatar
  • 5,271
1 vote
2 answers
553 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.
user avatar
0 votes
2 answers
164 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 ...
user avatar
2 votes
1 answer
188 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 ...
user avatar
  • 5,271
-2 votes
1 answer
54 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 ...
user avatar
  • 5,271
-1 votes
3 answers
149 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 ...
user avatar
  • 5,271
-2 votes
1 answer
114 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 ...
user avatar
  • 107
-4 votes
1 answer
61 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 ...
user avatar
0 votes
1 answer
109 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. ...
user avatar
1 vote
1 answer
188 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 ...
user avatar
  • 213
0 votes
3 answers
184 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, ...
user avatar
0 votes
2 answers
227 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 ...
user avatar
1 vote
1 answer
99 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 ...
user avatar
  • 127
-4 votes
1 answer
109 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 ...
user avatar
-2 votes
1 answer
94 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 ...
user avatar
  • 2,412
-4 votes
1 answer
78 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 ...
user avatar
  • 93
-1 votes
1 answer
251 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 ...
user avatar
  • 3,843
-3 votes
2 answers
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
  • 159
3 votes
7 answers
2k 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 ...
user avatar
4 votes
4 answers
272 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 ...
user avatar
-2 votes
1 answer
555 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 ...
user avatar
  • 3,319
-2 votes
2 answers
855 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 ...
user avatar
-1 votes
2 answers
126 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 ...
user avatar
  • 115
2 votes
1 answer
68 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 ...
user avatar
  • 2,148
-2 votes
1 answer
167 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 (...
user avatar
1 vote
1 answer
1k 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 ...
user avatar
  • 127
4 votes
1 answer
5k 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 ...
user avatar
  • 159
38 votes
10 answers
13k 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? ...
user avatar
  • 533
0 votes
1 answer
152 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 ...
user avatar
  • 1,856

1
2 3 4 5 6