Memory allocation is an operation of giving a program a block of memory.
Questions tagged [allocation]
1869 questions
0
votes
4 answers
memory allocation in details
May be the question is very simple, but I would like to know what exactly happens when I do this:
int arr[10];
The more specific question:
I know this is a static memory allocation, but where is it monitored which part of memory is occupied?
thank…

Igor
- 1
0
votes
1 answer
Left and Right Node pointers in Huffman tree not pointing to anything
struct Node{
int freq;
string character;
struct Node *left;
struct Node *right;
};
I've parsed a file and created a priority queue of Nodes. Each node has an int of frequencies, a string for the characters being represented in the…

Alfredo Gonzalez
- 5
- 3
0
votes
1 answer
VM:Allocation causes app to crash
My app uses NSTimer variable which uses NSNotificationCenter.postNotificationName to post notification to UIViewController class every seconds.
The issue is the app crashes once in a while with no stacktrace which mean it is a memory issue.
From…

Motoko
- 1,062
- 2
- 15
- 32
0
votes
1 answer
How to map bits from a bitmap to physical pages in a buddy allocator?
I've created my own buddy allocator with a bitmap (for managing my kernel's physical memory), with each bit corresponding to a page block of particular size.
Since I map the whole 4GiB address space, logically the 1st bit would represent a 4GiB…

Ivan Stanev
- 133
- 1
- 11
0
votes
1 answer
Variable Allocation and the change allocated Objects
findCycle() is about finding a Loop in which a Streetsection is not used twice. Now if i do nextStreetSection.setMarked(), is it the StreetSection of
currentPlace that is getting marked or is it just the local variable nextStreetSection ? If its…

Grunwalski
- 129
- 5
0
votes
2 answers
Linked List- NULL pointer check?
In this code snippet for adding to a Linked List, what is if (List==NULL) doing? I tried to throw some inputs at it to see if I could engage that statement with no luck. What type of input would work?
main()
{
struct Node *List;
List =…

Ragnar
- 15
- 4
0
votes
2 answers
Removing preallocating warning when preallocating is done in another file
I have some parameters changing size on every loop iteration in main.m. I have placed the preallocations in another script called preallocation.m.
When the preallocations is placed in another script, I get a warning from Matlab for every parameter…

ROLF
- 284
- 2
- 14
0
votes
1 answer
MIPS Dynamic Array Error
I'm trying to allocate a dynamic array and get it to accept input from the console, but once I start entering a few of the numbers into the array it says there is an Exception 7 error. (Bad Data Address)
Here is the code I use before running the…

rollerz
- 25
- 8
0
votes
4 answers
Dynamically allocating a structure in C++ using malloc
#include
#include
#include
using namespace std;
struct product{
string productName;
float price;
};
int main()
{
struct product *article;
int n=2; // n represent here the number of products
…

Yassine Bakkar
- 107
- 1
- 13
0
votes
0 answers
Why does allocating a lot of memory give worse results?
So in my assignment I am testing the times it takes for different copying functions to copy. One of them I am a bit curious on the results. In one my copy functions it involves allocating memory like so:
int copyfile3(char* infilename, char*…

Smreks
- 317
- 1
- 7
- 19
0
votes
0 answers
What exactly does dealloc(num:) do to an UnsafeMutablePointer?
I'm fiddeling aroung with Swifts UnsafeMutablePointer type, and came across the dealloc(num:) method.
Now my knowledge on how pointers work in Swift are all based on assumptions, which have seemed to hold up until now though:
the…

Marcus Rossel
- 3,196
- 1
- 26
- 41
0
votes
2 answers
How do I use pre-allocated memory when loading a Image in .net
I am wondering if it is possible to load an Image-File directly to the preallocated memory WITHOUT a new allocation for the bitmapimage itself.
I wrote a sample class to demonstrate what I want to do.
public class PreAllocatedImageLoader
{
…

Andreas
- 3,843
- 3
- 40
- 53
0
votes
4 answers
Malloc, and size on 32 bit machines
#include
#include
int main()
{
int *p;
p = (int *)malloc(20);
printf("%d\n", sizeof(p));
free(p);
return 0;
}
On my 64-bit machine, 4 is printed as the size of p. I'm assuming this…

db2791
- 1,040
- 6
- 17
- 30
0
votes
1 answer
Reading in values using pointers
I have the following code, and i'm wondering how I can store each line of a text document into an array of pointers. I think im close but i'm getting a few errors.
#include
#include
#include
int main()
{
FILE *…

BeginnerC96
- 9
- 6
0
votes
0 answers
Basic Matrix operation with dynamical array allocation using MPI
I have already looked for answers about MPI and dynamic allocation, but there is still an error in my code.
I think the pairs send/receive work well. The problem is probably due to the identical part when I want to do some basic operations. I can't…