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
1
vote
4answers
237 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
142 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
120 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
1answer
81 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
1answer
91 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
189 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
75 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
47 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
149 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
85 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
763 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
357 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
154 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
89 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
50 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
120 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
111 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
56 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
89 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
176 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
154 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
112 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
97 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
101 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
86 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
73 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
177 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
106 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
256 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
357 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 ...
-3
votes
2answers
453 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
123 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
66 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
81 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
739 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 ...
1
vote
1answer
930 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
11k 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
139 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
211 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
325 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++). ...
2
votes
2answers
2k views

Can Rust replace the C or C++ programs in the Future? [closed]

I recently read an interesting Article that, due to a memory Overflow error Power system of Boeing will collapse and turns the Flight into a Flying Brick. This is a low level memory Handling bug. ...
-3
votes
3answers
810 views

Is it an ok practice to keep pointers dereferenced?

For me, I prefer having all my variables, not as pointers. Is it ok to keep all heap-allocated variables dereferenced? For example: #include "Foo.hpp" #include "Bar.hpp" class Foo { private: Bar* ...
3
votes
1answer
161 views

Arranging blocks of data for efficient memory access

Suppose I have an algorithm that has N blocks of data, and an operation needs to be performed on all blocks such that it requires 2 blocks to be in memory at any given time to be done for all possible ...
2
votes
1answer
583 views

What is the difference between a Page Table Entry and a Memory Descriptor List?

The definition of a MDL from Microsoft is: The operating system uses a memory descriptor list (MDL) to describe the physical page layout for a virtual memory buffer. The definition of a Page ...
0
votes
0answers
57 views

Zipping and downloading multiple files

We're currently designing an web application that will basically expose "messages" to end users, each message consisting of a subject and body, but more important 1 to many files we call "attachments"....
1
vote
1answer
181 views

Will Windows handle any memory not freed as well as threads not closed? [closed]

If I had an application that pretty much had a "fail-safe" as in, if I need to terminate the application quickly and not free the malloc'd memory, or close the threads that are running, would Windows ...
1
vote
2answers
537 views

Splitting a critical application into multiple executables

We're developing some C++ application that analyses strings using some data. The data is large (a few gigabytes) and takes a significant amount of time to load into memory, and timing, as well as ...
1
vote
3answers
1k views

Does each process have it's own section of data, text , stack and heap in the memory?

I have created the above picture to illustrate my question. Is there a section within memory (lets say from address 0x1 to 0x15) that all processes use to place their text segment in (left figure), ...

1
2 3 4 5 6