Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [memory-allocation]

The tag has no usage guidance.

0
votes
1answer
30 views

How does the memory of a 64bit and 32bit processor work

In this article, the author states that a 64bit processor can theoretically reference 2^64 bytes of memory. What does he mean by this statement, or rather the word, reference? Also, I visualize the ...
0
votes
0answers
11 views

Memory addressing

What does the following sentence mean? "The 8085 micropressor has the capability of addressing 64KB of RAM?" In general, what is the meaning of a CPU's ability to address a given amount of memory? ...
0
votes
0answers
6 views

Memory interfacing problem [duplicate]

I've learnt that the memory interfacing problem is used when we need to connect a memory that has lesser number of locations to a processor that has more address lines. For eg. Connecting memory chips ...
1
vote
2answers
32 views

Random access memory and data

What kind of data is stored in the RAM when it is fresh out of manufacture? Apart from certain basic instructions (if yes, what are they), are there numbers stored as well or are most of the memory ...
1
vote
0answers
21 views

Addresses with no memory allocated

I've read that a program can crash if it tries to access addresses with no memory allocated. But, how is it possible that an address has no memory allocated? When does it happen?
0
votes
2answers
43 views

How does a computer remember the address of a data variable in a program, in the main memory?

Suppose I write a program as below: int main() { int a = 3; int b = 4; return 0; } Suppose the computer stores the address of 'a' as 0x00104. How does it ...
1
vote
1answer
27 views

Binary trees and preallocated nodes

I want to design a binary tree with preallocated nodes, in order to avoid calling malloc/free every time I want to insert/delete a node. The problem is I don't know ahead of time how many nodes the ...
1
vote
2answers
3k views

How is the formula for calculation in row/column major obtianed?

In my book, this formula is given for calculation of address of row major order's element $[I,J]$: Address of $[I,J]$th element in row major order $= B + W[n(I-L_r)+ [J-L_c]]$ where B denotes base ...
1
vote
1answer
29 views

Allocating memory via Buddy Allocation

I'm trying to learn buddy allocation and whilst I think I understand the basics of it, there is one problem exercise with which I'm struggling with. So I have an 8K block and I'm using buddy ...
2
votes
0answers
18 views

Sweeping integrated into memory allocation: Why only fixed size objects?

In our language design book, it is mentioned that GC sweep can be integrated into allocation, such that when you call malloc for example, you sweep until you find a ...
2
votes
1answer
724 views

What is the time complexity of memory allocation assumed to be?

It is well-known that dynamic arrays have an amortized $O(1)$ time complexity for adding one item, but a worst-case $O(n)$ complexity. This is because for particular values of $n$, there is no more ...
1
vote
2answers
39 views

If you increase the address space for an OS, does the Phys Mem used by the program increase?

I am learning about the OS. I know: that Address Space Size = # of pages x page size So if I increase Address Space Size, then the number of pages increases:(not the page size). However, isn't the ...
1
vote
1answer
1k views

Why do we use dynamic memory allocation in general and why did we use it in this particular example? [closed]

Dynamic Programming C/C++ implementation of LIS(Longest Increasing Subsequence) problem ...
40
votes
8answers
10k views

How are variables stored in and retrieved from the program stack?

Apologies in advance for the naivety of this question. I am a 50 year old artist trying to properly understand computers really for the first time. So here goes. I have been trying to understand how ...
1
vote
1answer
749 views

How does malloc(sizeof(char)) work [closed]

AFAIK, malloc(sizeof(char)) is intended to allocate a 1-byte block of VM and strcpy requires that the destination string dest must be large enough to receive the copy That means theorically that ...
2
votes
1answer
419 views

Do modern operating systems use memory control blocks?

I was taught in my operating systems class that sections of memory in the heap are marked as free/occupied through the use of memory control blocks (MCB). The generalized definition of an MCB that was ...
2
votes
2answers
2k views

Row Major Vs Column Major

People prefer accessing a 2D array in row-major order than column-major order. Why row-major is efficient? Is there some advantage of row major as compare to column major wrt memory.
0
votes
1answer
98 views

Less used data (1 byte) in memory address holding 4 bytes [closed]

I need to store two distinct variables of 1 byte size in memory. My memory system stores 4 bytes at one address; therefore, you cannot address byte 3 directly, and you have to logically access it ...
0
votes
0answers
150 views

Direct Mapped Cache, textbook excerpt clarification, identifying block field

I have an excerpt from my textbook concerning direct mapped cache that I would like further clarification on, the text reads..... "Consider the following example: Assume memory consists of 2^14 ...
-1
votes
1answer
5k views

How to compute total internal and external fragmentation

I want to find the total external and internal fragmentation. What I understand is that external fragmentation occurs when processes are loaded and removed from memory, causing memory to be broken ...
1
vote
3answers
818 views

Does word addressable memory have more bytes than byte addressable memory?

Well, my question - if word addressable memory has more bytes than byte addressable memory - is derived from the fact that in word addressable memory each address addresses a word and in byte ...
2
votes
1answer
50 views

Why not space out memory allocations?

In ext4 file system, the files are spaced out as far apart as reasonably possible to allow for efficient reallocation. Why do we not do this in memory? Why not allocate one memory as page 20, and the ...
3
votes
1answer
323 views

Combining adjacent memory blocks

This is a conceptual issue that I am having in designing an algorithm for a memory allocator that works in conjunction with memory pooling. Free blocks are put on one of several free lists within the ...
1
vote
2answers
1k views

Why is data fragmentation not possible on main memory (RAM)?

I am wondering why data fragmentation is a problem on main memory. On a software level, virtual addresses are used anyway. So why can one address space not be split up into multiple segments, like a ...
0
votes
1answer
63 views

Memory address of variable after reassignment

When a local variable is reassigned a different value/object, does its position/address change in the stack?
6
votes
1answer
499 views

How do arrays work “under the hood”?

In some languages (such as C), arrays seem very simple to me. When allocating memory for these, all you need to do is pick a starting point in memory and then allocate the next ...
9
votes
2answers
7k views

Can someone explain this diagram about Slab Allocation?

I'm trying to understand how Slab Allocation works and why it is different or better than ordinary paging. I found this diagram which I believe would be helpful if it had more explanation. Some ...
1
vote
1answer
5k views

Would it be possible to use the cloud for RAM?

I'm not sure if this is the right place to ask but I had this idea. Since the cloud can be used for storing memory, would it be possible to use it for RAM too?
4
votes
0answers
278 views

When there's no memory, should malloc or read/write fail?

To my surprise, I recently found out that Windows would fail a large memory allocation even if little of said memory is to actually be used, e.g. even if you don't want the swap, you better not ...
2
votes
2answers
523 views

where is all deleted data will go from memory system/internet? [closed]

where is all deleted data will go from a memory system ? if it is not deleting actually where it storing ? i am always wonder about this when we are sending something to a memory system it takes ...
7
votes
3answers
12k views

How are hash table's values stored physically in memory?

Question: How are hash table's values stored in memory such that space if efficiently used and values don't have to be relocated often? My current understanding (could be wrong): Let's say I have 3 ...
0
votes
1answer
65 views

In Ada95 how many bytes does integer occupied in memory? [closed]

Also asking for float, character, ect.
0
votes
1answer
52 views

Name for almost random memory distribution on the heap

If I had a heap like the following: with blue blocks being occupied memory and white blocks being free memory What is the general name given to the situation illustrated, where the free and occupied ...
2
votes
3answers
3k views

How is heap memory allocated to a process?

I want to better understand how OS provides heap memory to a process. Here by heap memory I mean the memory allocated dynamically, say by call to malloc. When a ...
-1
votes
1answer
126 views
0
votes
1answer
5k views

Dynamic loading vs. dynamic linking?

What is the difference between dynamic loading and dynamic linking? Both systems seem to allow shared libraries, but I am struggling to differentiate between them.
0
votes
1answer
108 views

How Does Dynamic Heap Storage Have Something to Do with Heap?

There are three typical ways to allocate memory for programs: static, stack and dynamic heap. However, when I look at the implementation of dynamic heap memory allocation from wikipedia , what I found ...
3
votes
2answers
9k views

Direct vs. Random Access

Would someone please clarify for me the difference between direct and random access? Specifically, why does this Wikipedia article on Direct Access Storage Devices distinguish between the two: ...
3
votes
3answers
4k views

How does worst-fit memory allocation react when encountering contiguous empty memory blocks?

So I have a problem understanding how the worst-fit protocol for memory allocation reacts to contiguous blocks of empty memory. None of the examples I have found address this possibility. For ...
11
votes
1answer
4k views

Swap space management during pure demand paging

The following is a doubt that I came across while doing a OS home assignment - however, it seems more concept-based than a straightforward coding question, so IMHO I don't think the homework tag is ...
17
votes
3answers
1k views

Clever memory management with constant time operations?

Let's consider a memory segment (whose size can grow or shrink, like a file, when needed) on which you can perform two basic memory allocation operations involving fixed size blocks: allocation of ...