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
1 answer
185 views

Protecting garbage collection data structure with reader-writer lock might not be appropriate?

I'm thinking about implementing garbage collection efficiently by protecting the structure that tracks allocations using reader-writer lock. However, I'm worried memory semantic may invalidate the ...
DannyNiu's user avatar
  • 219
1 vote
2 answers
310 views

Does Java keep stream objects in memory after mapping them?

Say I have the following stream: List<Other> list = Stream .of( new MyObject(), new MyObject() ) .map(this::mapToOther) .collect(toList()) ; So after this is ...
user1589188's user avatar
0 votes
5 answers
210 views

Load and process (compressed) data from filesystem in the blink of an eye

We have a huge amount of queries hitting our API that request a minor or major extract of some huge files lying around on our mounted hard drives. The data needs to be extracted from the files and ...
glades's user avatar
  • 377
1 vote
0 answers
101 views

How to store an encrypted filesystem in a single file on disk on multiple platforms (maybe not portably), or alternatives

I'm in the very conceptual phase of designing an open source password manager that provides distributed Vaults that can be simultaneously accessed and managed from multiple devices with the promise of ...
Nick Williams's user avatar
0 votes
2 answers
183 views

Sandboxing interpreted code

I have a little pet compiler project that generates bytecode interpreted by a virtual machine. The language is kind of low-level, as it allows the user to manually allocate memory and dereference any ...
chrysante's user avatar
  • 127
2 votes
2 answers
197 views

Optimizing Flash Memory Writes in Embedded Systems with Unpredictable Power Loss

I'm working on an embedded C++ project that involves logging certain types of statistical data (like successful accesses, failed attempts, and other events) to the flash memory (just incrementing ...
Dario.Casciato's user avatar
1 vote
4 answers
232 views

Is the maximum number of outstanding load instructions limited by the CPU architecture or the program?

I'm reviewing some lecture slides and had a question on the following slide : Assumptions (8 clocks to transfer data) Up to 3 outstanding load requests. The slide is illustrating that the number of ...
Carpetfizz's user avatar
3 votes
3 answers
274 views

What is the best way to retain a local object which is performing an asynchronous task?

My problem is the following: inside a method I'm creating an object like this: MyObject* myObject = [MyObject new]; Then I want it to perform an asynchronous task like this: [myObject ...
Andrey Chernukha's user avatar
0 votes
1 answer
472 views

C++ wrapper around raw array - memory management

I have simple wrapper class around C-style array. I don't want to use std::vector since I want to have only one array even if I do copy of the struct. With std::vector the vector is also copied. ...
Martin Perry's user avatar
-1 votes
2 answers
327 views

what algorithm does the malloc function in the c language standard library use? And why it so fast?

Based on the data structure of the AVL tree, I implemented a memory manager that does the best matching according to the size. I originally thought that the speed would be fast and the length of the ...
CukiPid's user avatar
  • 11
0 votes
1 answer
162 views

Sink or non-sink API's?

This might be an opinionated question but I'm eager to hear your anecdotes as I'm at the beginning of designing a new API. Now I'm questioning whether I want this API to be a sink API or non-sink API. ...
glades's user avatar
  • 377
8 votes
3 answers
221 views

Choosing one of two memory blocks to deallocate: Does age affect fragmentation?

First question here, so preemptive apologies if I've committed some faux-pas. Additionally, I am aware that this question is about possibly the micro-est of micro-optimizations ever, and "micro-...
Da Spud Lord's user avatar
0 votes
3 answers
103 views

How multiple type lists are stored in memory?

Arrays are stored in a linear fashion, with memory cells of fixed size for each element. To have fixed sized memory cells Arrays should be homogenious. So in Arrays we get an Nth element by skipping ...
forty5's user avatar
  • 39
1 vote
3 answers
310 views

Memory on multiple cores versus 1 core

I am running a program that, among other things, does some matrix multiplications, singular value decompositions and accessing matrix subsets on a very large data set (these are the lines of code that ...
Andy's user avatar
  • 19
1 vote
4 answers
1k views

Memory Alignment

I want to make sure I understand the concept referred to by alignment: Is it just a way of making sure that you never have a non-integer number of words? The wikipedia page says in order for an access ...
Hello's user avatar
  • 19
34 votes
7 answers
9k views

Does Garbage Collection Scan The Entire Memory?

I was reading a bit about garbage collectors and I am wondering if the garbage collector of a program scans the entire heap memory or what is allocated to it? If it reads the entire system memory, ...
PoJam's user avatar
  • 475
3 votes
4 answers
842 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 "...
Curious's user avatar
  • 95
2 votes
4 answers
174 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 ...
miqem's user avatar
  • 85
3 votes
1 answer
87 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 ...
Mecki's user avatar
  • 2,320
3 votes
4 answers
1k 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 ...
user2190492's user avatar
0 votes
1 answer
222 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 ...
Mugen's user avatar
  • 111
0 votes
3 answers
1k 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 ...
jdow's user avatar
  • 194
0 votes
1 answer
147 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 ...
kkeey's user avatar
  • 111
8 votes
4 answers
1k 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-...
darkblueflow's user avatar
9 votes
5 answers
8k 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, ...
jdow's user avatar
  • 194
5 votes
2 answers
834 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 ...
jdow's user avatar
  • 194
1 vote
4 answers
9k 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 ...
I_like_robots's user avatar
3 votes
2 answers
3k 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 ...
DrWCTapir's user avatar
4 votes
1 answer
3k 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; ...
Anon's user avatar
  • 3,593
4 votes
2 answers
141 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 ...
Tim's user avatar
  • 5,435
0 votes
2 answers
653 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]...
Tim's user avatar
  • 5,435
1 vote
3 answers
2k 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 ...
steez's user avatar
  • 31
-2 votes
1 answer
403 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){ ...
ShayakSarkar's user avatar
1 vote
1 answer
111 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 ...
qwerty_99's user avatar
  • 163
2 votes
2 answers
231 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 ...
qwerty_99's user avatar
  • 163
-5 votes
2 answers
1k 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 ...
CodingNewbie's user avatar
2 votes
5 answers
5k 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 ...
Tim's user avatar
  • 5,435
1 vote
2 answers
759 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.
Curious's user avatar
  • 95
0 votes
2 answers
176 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 ...
Mk Kvease's user avatar
2 votes
1 answer
332 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 ...
Tim's user avatar
  • 5,435
-2 votes
1 answer
75 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 ...
Tim's user avatar
  • 5,435
-1 votes
3 answers
212 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 ...
Tim's user avatar
  • 5,435
-2 votes
1 answer
118 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 ...
Nojan A.'s user avatar
  • 107
-4 votes
1 answer
66 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
149 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. ...
Ameer Abdallah's user avatar
1 vote
1 answer
281 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 ...
Jack M's user avatar
  • 213
0 votes
3 answers
218 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, ...
infinity8-room's user avatar
0 votes
2 answers
538 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
118 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 ...
quester's user avatar
  • 127
-4 votes
1 answer
113 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 ...
appmaker1358's user avatar

1
2 3 4 5
7