Skip to main content

Questions tagged [allocation]

Filter by
Sorted by
Tagged with
0 votes
2 answers
303 views

For, e.g. determining an amount of memory that is safe to allocate for processing file or device with this type of I/O loop: HANDLE hFile /* = file open with GENERIC_READ */; LARGE_INTEGER liSize; ...
Govind Parmar's user avatar
16 votes
6 answers
10k views

So, the problem: When I run the same C++ code in Visual Studio, with the same input and parameters, I get either the correct output, or an output that is completely messed up (99% of values go to zero)...
babipsylon's user avatar
1 vote
3 answers
379 views

What is the standard for heap allocation systems in bare metal programs? If there is no standard, what is the most popular one? Is it a free list? If so, are there heuristics that use a hash table of ...
nicholasbelotserkovskiy's user avatar
0 votes
5 answers
296 views

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
  • 493
6 votes
2 answers
2k views

I'm going through some code from this article about ECS-systems in game programming and trying to understand it, and something I'm seeing a lot is using heap memory in places where it seems like ...
JensB's user avatar
  • 277
0 votes
1 answer
165 views

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
1 vote
4 answers
1k views

I have a function that repeatedly encodes Foos to string. I'm currently deciding between two ways to implement this: Return by value: std::string encode(const Foo& foo); void important_function() ...
cube's user avatar
  • 157
0 votes
3 answers
265 views

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
4 answers
760 views

I am still quite new on here so I hope I am posting in right forum. I am currently writing a small library where I realized I could use some kind of design pattern which lets one pass constructor ...
mathreadler's user avatar
2 votes
1 answer
124 views

I have a scenario for which I'll take an analogous example to help understand better. There are N buckets of known varying capacities. We have M balls that we need to put in these buckets to fill ...
Varinder Singh's user avatar
16 votes
2 answers
7k views

The following code causes a memory leak: #include <iostream> #include <memory> #include <vector> using namespace std; class base { void virtual initialize_vector() = 0; }; ...
Inertial Ignorance's user avatar
3 votes
7 answers
2k views

I was wondering what would be the best approach to allocate/deallocate multiple one-dimensional, dynamic arrays in C. This seems easy at first, however, for me it turned out to be problematic. ...
MaxPowers's user avatar
  • 141
26 votes
2 answers
9k views

All the sites I go to look for informations on FAT16 just declaratively state that it can not allocate more than 2 GB. OK. Great. I believe you. But how do you come to that conclusion (other than just ...
SangoProductions's user avatar
-2 votes
1 answer
907 views

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 ...
Elijah Hampton's user avatar
1 vote
0 answers
490 views

I have the following abstract class which implements the "Allocator" concept, using policies and traits to customize behavior: #define FORWARD_ALLOCATOR_TRAITS(C) \ typedef ...
MattyZ's user avatar
  • 113
1 vote
4 answers
2k views

I have a big doubt about dynamic allocation. Suppose you have a class like this: class MyClass { public: MyClass() {} ~MyClass() {} private: std::vector<...
Marco Stramezzi's user avatar
3 votes
3 answers
2k views

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 ...
Vroomfondel's user avatar
3 votes
1 answer
809 views

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::...
Justin's user avatar
  • 176
5 votes
5 answers
2k views

The background I am working on an ECS in C++ for fun and I am trying to make it as efficient as possible. One of the optimisations I am striving to implement is to minimise cache misses by storing ...
sjaustirni's user avatar
0 votes
2 answers
139 views

We have a big set of survey questions, which we distribute to users online. We collect submission from users and based on their submission, we decide the answers for those questions. Now, each user ...
theGamblerRises's user avatar
3 votes
2 answers
2k views

If I want to allocate a struct in C, #include<stdio.h> typedef struct container { int i; } Container; int main() { Container *ptr_to_container; ptr_to_container = (Container *) ...
jado's user avatar
  • 141
2 votes
2 answers
136 views

I am redesigning a system by which conference participants can choose which track they want to attend. Participants express their track preferences arranging them in order and submitting them at a ...
Federico B.'s user avatar
1 vote
1 answer
228 views

I am on a micro controller (which means I can only have static memory allocation) and I am trying to work with inheritance..... Suppose I have a abstract class Image and an abstract class Font. An ...
DarthRubik's user avatar
1 vote
0 answers
116 views

I have a question about assigning values to nodes laid out in a physical space: There is a set of N fixed nodes spread out throughout a certain 2 dimensional region that need to be assigned a value ...
Decumanus's user avatar
2 votes
1 answer
6k views

In Big O notation, allocate an array of N element is defined by O(1) or O(n) ? For example in C#, if I allocate an array like this : int[] a = new int[10] When I display this array, I have : {0,0,0,...
csblo's user avatar
  • 229
6 votes
1 answer
428 views

I was just writing a function (in C# in this case) that stored huge amounts of data in a local variable early on in the code, let's say at 5% of the functions code. After that point, the data in this ...
Mark's user avatar
  • 403
9 votes
3 answers
9k views

With the latest trends about C and C++ applications, and with latest I mean the latest years, I was expecting to see std::allocators to be used way more frequently than what it really is. Modern ...
user2485710's user avatar
0 votes
2 answers
5k views

I have a question regarding dynamic initialization. Example code void main() { int a = 100; //Statement1 //Statement2 ... float b = 6.32987; //StatementA ... return; } The StatementA allocates ...
Rizwan S A's user avatar
7 votes
2 answers
8k views

I'm working on image processing and I need to use big Images in a critical system. A good practice for critical systems is to avoid dynamic allocation of memory but what is the design/recommendations ...
jblasius's user avatar
1 vote
0 answers
326 views

I have to solve a problem in the field of operations research. I want to gather some general approaches to evaluate them to pick the most promising to design a problem-related program. Problem ...
mike's user avatar
  • 153
2 votes
2 answers
9k views

I am currently doing a project (in PHP) that has the following requirements: There is a list of people, sorted in a certain priority. Work should be allocated to them by this priority. e.g. If the ...
Wee's user avatar
  • 139
3 votes
2 answers
5k views

So when you call malloc or new [] from your C/C++ application, how does the CRT translate it into Windows API calls?
CS01's user avatar
  • 149
1 vote
3 answers
397 views

I have a matrix. I have a list of people who have to occupy n1,n2,n3 etc cells, different number of cells in different rows. I have to place the people in the cells. Occupying the same cell across ...
Kinjal Dixit's user avatar
11 votes
4 answers
5k views

Suppose this: void func() { ... if( blah ) { int x; } ... } Is the space for x reserved on the stack immediately when func is entered, or only if the block is actually executed? Or is it ...
Petruza's user avatar
  • 1,058
5 votes
2 answers
645 views

Apparently, the two major judging criteria of the effectiveness of heaps are (1) how much we can minimize the amount of space it takes up and (2) how fast operations on the heap can be carried out, eg,...
Dark Templar's user avatar
  • 6,323