allocation Questions
1
Solved
I was thinking about the utility of non-standard __restrict keyword in C and C++ and how its effect can be emulated by carefully declare (disjoint) value objects .
Restrict is usually explained thr...
Midget asked 20/10 at 20:45
8
Solved
I was of the impression that in C#, struct elements are allocated on the stack and thus disappear when returning from a method in which they were created. But what happens if I place the struct-val...
Payment asked 31/1, 2011 at 16:19
3
Solved
I've seen both terms used for wrappers to memory allocators, whats the difference between these? (if any)
Barcroft asked 9/8, 2017 at 1:55
1
Solved
Given the following code, why is the capacity of each of the vectors 0 instead of chunk_size?
#[test]
fn test() {
let chunk_size = 1024;
let data: Vec<Vec<u8>> = vec![Vec::with_capaci...
Sigismond asked 19/9, 2023 at 18:11
5
Solved
In Go, what is the difference between var s []int and s := make([]int, 0)?
I find that both works, but which one is better?
Rondi asked 28/8, 2014 at 7:51
10
Solved
I'm trying to make a pointer point to a 2D array of pointers. What is the syntax and how would I access elements?
Teteak asked 20/11, 2009 at 4:11
2
I have a linked list inside a struct in C, or so I think.
The structs are:
//Structure of the domain list
typedef struct domains *domain_list;
struct domains{
char *domain;
domain_list next;
}d...
Candicandia asked 23/10, 2015 at 0:44
2
But it works fine with Instruments->Time Profiler.
All the other documents are closed.
Am trying to find a tool to find how much memory is used by my c++ code.
Offhand asked 31/10, 2022 at 11:21
2
Solved
I've been trying to figure out when things get allocated on stack and I can't figure out how would you make array (or rather values in it) get allocated on stack;
in this example:
public void foo...
Misjudge asked 28/8, 2015 at 15:1
2
The code:
func MaxSmallSize() {
a := make([]int64, 8191)
b := make([]int64, 8192)
_ = a
_ = b
}
Then run go build -gcflags='-m' . 2>&1 to check memory allocation details. The result:
...
Selfpollination asked 15/2, 2017 at 7:34
2
I am starting to use Julia mainly because of its speed. Currently, I am solving a fixed point problem. Although the current version of my code runs fast I would like to know some methods to improve...
Southsoutheast asked 25/7, 2022 at 14:40
3
Solved
I'm trying to search for the desired pattern (variable template) in the array X. The length of the template is 9.
I'm doing something like:
function check_alloc{T <: ZeroOne}(x :: AbstractArra...
Reitz asked 1/12, 2017 at 9:58
8
Solved
int main() {
Employee *e = new Employee();
delete e;
delete e;
...
delete e;
return 0;
}
Arthralgia asked 30/4, 2010 at 18:12
24
Solved
alloca() allocates memory on the stack rather than on the heap, as in the case of malloc(). So, when I return from the routine the memory is freed. So, actually this solves my problem of freeing up...
Greenland asked 19/6, 2009 at 16:24
3
I am looking for algorithms for allocating reservations to resources. This could be Hotel reservations matched to available rooms - Meeting reservations matched to available meeting rooms - Restaur...
Selfcommand asked 14/1, 2011 at 12:47
4
Solved
I don't understand why Box::new doesn't return an Option or Result.
The allocation can fail because memory is not unlimited, or something else could happen; what is the behavior in such cases? I c...
Fizgig asked 5/7, 2017 at 10:14
3
Solved
Given a container v with v.size() == 3 and v.capacity() == 5, my understanding is that a call to v.shrink_to_fit() can be fulfilled and, if it is, it causes v.capacity() to become 3.
However, this ...
Kofu asked 9/2, 2021 at 9:2
4
Solved
How can I preallocate a std::priority_queue with a container of type std::vector?
std::priority_queue<unsigned char, std::vector<unsigned char>> pq;
pq.c.reserve(1024);
Does not com...
Tipperary asked 24/3, 2015 at 15:1
15
Solved
Is there a way in C to find out the size of dynamically allocated memory?
For example, after
char* p = malloc (100);
Is there a way to find out the size of memory associated with p?
Restivo asked 15/8, 2009 at 11:21
3
Solved
Is there a way to get the total number of allocations (note - number of allocations, not bytes allocated)? It can be either for the current thread, or globally, whichever is easier.
I want to chec...
Singleness asked 7/4, 2020 at 13:24
4
Solved
If I have this code:
class A { ... };
class B { ... };
void dummy()
{
A a(...);
B b(...);
...
}
I know that variables a and b will be destroyed in reverse allocation order (b will be destroy...
Guile asked 10/3, 2011 at 9:35
1
Solved
Yes, I will ultimately be using this for DMA but lets leave coherency aside for the moment. I have 64 bit BAR registers, therefore, AFAIK, all of RAM (e.g. higher than 4G) is available for DMA.
I a...
Loleta asked 8/6, 2019 at 16:21
5
Solved
Given the code:
class Foo {
std::vector<int> items;
std::map<int, int> dictionary;
};
If nothing is ever added to the above vector or map, will either still allocate a block of bu...
Claudelle asked 24/2, 2016 at 17:36
1
Solved
I have following benchmark which read string from file using Stack allocation, Heap allocation and ArrayPool allocation.
I would expect that Stack allocation is fastest, because it is just stack ...
Crapulous asked 18/3, 2019 at 20:25
2
Solved
When programming games, I used to store all game Objects in a std::vector with initialized and fixed size. Recently I felt the need for some inheritance among the game object classes.
So lets assu...
Chadwick asked 7/7, 2017 at 21:2
1 Next >
© 2022 - 2024 — McMap. All rights reserved.