Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

0
votes
0answers
101 views

Why don't browsers protect against memory leaks from web pages scripts? [on hold]

I just found & reported a memory leak issue on a website. When i tried to load the page, my system's RAM filled up entirely in about 5 seconds, after which the swap space began to fill up at a ...
-1
votes
1answer
113 views

Executing an algorithm constantly on slow and fast machine

Is it possible to create an algorithm that will execute at the same rate and speed on faster and slow computers. What i mean is, i have a year 2000 desktop that can run a certain computational ...
3
votes
1answer
178 views

Why do we need to specify the type of data a pointer will hold, if all pointers are the same [duplicate]

Why do we need to specify the type of the data whose address, a pointer will hold, if all pointers are the same. Since all pointers store addresses. Also, the amount of space a pointer will require in ...
0
votes
1answer
95 views

Erlang: Memory implications of passing around large objects in/to functions

Is there a memory penalty to passing around large objects (like an entire http request, or the blob contents of an uploaded file) between functions within the same (Erlang) process? It is my ...
1
vote
1answer
45 views

Linked-list iteration patterns

If you have a linked-list, where the items are not necessarily close to each other in memory, wondering if it is (in general) better/worse/no difference to do the following. Say you want to iterate ...
2
votes
1answer
122 views

Algorithm for efficiently allocating memory

Given the following constraints: No multithreading. No care about hardware cache utilization. Wondering what a reasonably optimal memory allocation scheme would look like. From my limited knowledge,...
-1
votes
1answer
46 views

Question about memory handling of trees and certain sorts on large data sets.

If data structures such as trees and certain sorts(quick sort, merge sort) work using recursive algorithms and recursive algorithms take up a lot of memory space in the stack and can only work on a ...
0
votes
2answers
160 views

What is the safest practice in handling QWidget pointer lifespan in a QObject oriented environment?

Consider the following constructor: NetworkTools::NetworkTools(QObject *parent) : QObject(parent) { view = new QWebEngineView(); view->setParent(parent); // Produces an error, shown below. ...
0
votes
2answers
187 views

copying of memory vs pointer to memory in real time systems

While working in a multi-threaded environment, then data sharing seems to be a good option to pass data between threads. While working with real time systems it is apparently advisable to go with ...
1
vote
0answers
157 views

How does the BIOS detect the size of installed memory? [closed]

I'm writing a little toy operating system using a mix of C and Assembly (It's not meant to be good/fast, just meant to learn from). I know that I can issue an interrupt (I think it's INT 0x15) to ...
0
votes
3answers
271 views

Extending the concept of Lazy Loading, to also unloading

A system that sometimes will need to use a pretrained machine learning model. That model is about 10Gb on disk, and when loaded uses about 10Gb of RAM. Loading it from disk takes a nontrivial amount ...
0
votes
3answers
368 views

Memory segmentation - stack, heap, etc.?

So memory segmentation can be done with or without paging. I always hear people talking about stack and heaps when discussing something memory related in C++. However, what I do not get is that if the ...
-4
votes
1answer
75 views

How was memory allocated in Windows 9x compared to Windows 10 ?

I heard rumours that when a new program is executed in Windows 9x, that app had to specify how much memory it needs to allocate beforehand. How is this different in Windows 10 ?
2
votes
1answer
111 views

How do peripherals decide which address to use in memory-mapped I/O?

I've been reading about how memory-mapped I/O actually works and I cannot understand how the system assigns an address or address space to a specific device. Let's say I had two devices that I wanted ...
4
votes
2answers
167 views

Endianess ARM Assembly Confusion

I'm writing code using arm assembly language for college and the I'm really confused about endianess. The default should be little endian but I'm sure the test string has been stored big endian. The ...
-2
votes
1answer
608 views

First Fit Algorithm Memory Allocation

I am currently reviewing memory partitions and I have a problem that is really confusing me. Suppose you have 5 memory partitions: 100K, 500K, 200K, 300K, and 600K. Also suppose you have 4 ...
2
votes
3answers
873 views

What does “address space” means when talking about IO devices?

The following quote is from this page: While some CPU manufacturers implement a single address space in their chips, others decided that peripheral devices are different from memory and, ...
3
votes
1answer
972 views

How does the Base Address Registers (BARs) in a PCI card work?

I am trying to understand how the Base Address Registers (BARs) in a PCI card work, this is how I think they work: Each function in a PCI card have 6 BAR fields, and each BAR field is 32-bit in size. ...
0
votes
1answer
139 views

When is return-value optimization used? [closed]

In the code snippet below, I have a class that holds a vector, and a getter to access it. When I compile my code with optimizations turned on, I would have expected that the call to get_value() would ...
2
votes
1answer
130 views

What does “data bus control” mean?

This video mentions the following: What does it mean for the DMA controller to be granted the data bus control, does that mean the CPU cannot use the bus to access memory and IO devices until the DMA ...
-1
votes
1answer
103 views

Help With Memory Mapped I/O and Hardware Interrupts for Virtual Machine

I've been working on a 24-bit virtual machine to help me learn more about computers and programming in general and was hoping to find a bit more information on memory mapped input/output and hardware ...
1
vote
1answer
178 views

What would be a mathematical rigorous definition of a memory address space?

What is the exact definition of a memory address space? Is it correct to name the set of all the numbers from 0 to the highest addressable byte the definition of an address space? EDIT: I would like ...
3
votes
3answers
408 views

Is O(log n) for memory management considered slow?

I am talking about single thread general purpose memory allocation/deallocation from a global 'heap' as e.g. every C programmer knows in the form of malloc()/free(). I can't recite the actual title ...
-2
votes
1answer
189 views

Why is it possible to access an array out of bounds with negative indexes much further than with positive indexes?

I have written two small programs in which I declare a very small array. Then I try to access values out of bounds. The interesting thing I noticed that when I try to decrement the index I can ...
25
votes
3answers
6k views

Why does a long int take 12 bytes on some machines?

I noticed something strange after compiling this code on my machine: #include <stdio.h> int main() { printf("Hello, World!\n"); int a,b,c,d; int e,f,g; long int h; ...
1
vote
1answer
108 views

What architectures have “weak” memory models?

I'm a long-time Java programmer familiar with the Java Memory Model. I'm starting to learn C#, and based on what I've learned so far, the C# memory model seems to be very similar to the JMM. This ...
-4
votes
1answer
107 views

Memory bit address

I am having trouble to understand the following question for my Computer Architecture assignment. Consider a system that has a direct-mapped cache that contains a total of one megabyte; each line ...
5
votes
0answers
321 views

Best Practices For Writing Memory Efficient CSS

What are some best practices for writing memory-efficient (for the lowest peak memory usage) CSS? I realize this is a broad question, so I have broken it down into two main categories: What are 'do's ...
3
votes
1answer
187 views

How can I efficiently implement batch allocation in a freelist?

I've been implementing Andrei Alexandrescu's allocators as an exercise, but I've gotten stuck on his Freelist. Andrei's Freelist looks something like this: template<class BaseAllocator, std::...
-5
votes
1answer
149 views

How to convert a logical address to a paging system

ive had a look around and I cant seem to find an answer or how to work out this question, its a tutorial question for my operating systems course and ive looked through the notes that come with the ...
3
votes
0answers
123 views

C#: simulate PostScript memory allocation

I'm working on a PostScript interpreter in C#. PostScript has memory management. It has virtual memory (VM). It also has objects. Two types of objects: simple and composite objects. Composite ...
3
votes
2answers
192 views

Protecting Structure from corruption

I am developing a safety critical embedded system and I am programming in C. We have a set of const structure declared in memory and they hold some critical data. I want to make sure that any of ...
5
votes
8answers
965 views

Strategies for implementing memory leak detection [closed]

What strategy would you use to detect memory leaks? I was asked this question in an interview that was mostly focused on C++, and couldn't find an answer. I said that there are tools that do it and ...
3
votes
1answer
277 views

Is global state evil if it doesn't change behavior?

I have a library in C where the API uses "objects" to interact with the application. These "objects" are opaque pointers that are created, destroyed, and modified via API calls. These "objects" do ...
3
votes
2answers
762 views

Insertion sort vs Merge sort - memory access

I am a computer science sophomore doing a data structures and algorithms course. My professor said that insertion sort requires random access, while merge sort does not. According to him, the ...
3
votes
1answer
611 views

Purpose of Segmentation and Logical Addresses in 8086

In 8086, mapping of logical adderss to physical address is done with the help of segmentation. Segment registers : offset, and you get the physical location in a 2^20 byte RAM, even though you have 16 ...
20
votes
3answers
5k views

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

I'm developing a physics simulation, and as I'm rather new to programming, I keep running into problems when producing large programs (memory issues mainly). I know about dynamic memory allocation and ...
-4
votes
2answers
500 views

Proper way to implement a “dynamic array of non-default-constructible objects”

As many other questions and answers already stated, there is no syntax in C++ which allows you to declare and fill a dynamic-sized array with non-default constructible objects. Obj* array = new Obj[...
1
vote
3answers
462 views

What value does the byte pointed by null pointer have?

I know that long time ago computer scientists decided to treat all pointers to memory cell of address 0 as NULL. However, the memory cell at that address does exists after all, right? In that case, ...
0
votes
4answers
397 views

When it is worth it to spend RAM for computational speed? [closed]

I am developing data analytics algorithms that are supposed to process large amounts of data. Thus I am aiming to develop my mathematics already in such a way that it is possible to distribute the ...
0
votes
0answers
123 views

Optimizing a client-server visualization that runs out of memory

I have a visualization (shader-based) that I'm running in a Chrome browser. Recently I've been running out of memory after periodically refreshing the pool of data from the server, or if I make the ...
3
votes
3answers
1k views

Source of loading value to the register or memory location

When we load a register or memory location with a value (e.g. MVI 3A or MVI 53), what initializes register or memory location with that specific value? It is the CPU who performs the initialization, ...
2
votes
1answer
84 views

Fast and memory-optimized checking for values in database using php

I have a function to generate n random string with the same length, making sure there isn't any duplicates, and then saves them to the database. Right now, to speed things up, first I get all the ...
0
votes
3answers
485 views

Why is call stack not implemented as a dynamic array in modern OS? [duplicate]

When a modern OS loads a process, it pre-allocates a certain amount of space for stack. This means that the programmer has to be careful to avoid stack overflow by limiting call depth and/or by ...
1
vote
0answers
73 views

How is memory modeled in projects like Apache Spark or Druid?

In the past couple of months I've worked with both Apache Spark and Druid for some projects. As I've gone through the process of learning how to use these tools, I've spent some time reading through ...
4
votes
2answers
933 views

constraints in developing software

According to this As opposed to the constraints in other kinds of engineering, where the constraints of what you can build are the constraints of physical systems, the constraints imposed in ...
-1
votes
2answers
89 views

What programming environments can be used to illustrate and benchmark the unoptimized space complexity of an algorithm?

What programming language along with implementation and compiler can I use to study the pure, unoptimized space complexity of an arbitrary algorithm? And what methods can I use to do so? For example,...
1
vote
3answers
3k views

In-memory data collection object(s) vs database

I have a couple of questions about the practicality of developing a WPF application that loads data into memory from a text file and then manipulates the resulting object(s) instead of transactions ...
0
votes
1answer
108 views

How would I calculate how much memory can be addressed by the paging solution?

Given a modern 64-bit architecture with 6-bytes used for each page pointer, 1 MB pages, and 16 GB installed memory: a) How would I calculate how much memory can be addressed by the paging solution? b)...
3
votes
2answers
216 views

Understanding physical address

I'm reading this article, Low Level Programming of the Raspberry Pi in C, which explains how to access the raspberry pi on a low level. It states that the virtual gpio address is 0x7E200000. ...