allocation Questions

2

If you profile a simple client application that uses SocketAsyncEventArgs, you will notice Thread and ExecutionContext allocations. The source of the allocations is SocketAsyncEventArgs.StartOpera...
Elwin asked 12/8, 2014 at 17:4

2

Solved

I'm an embedded software developer and as such I can't always use all the nice C++ features. One of the most difficult things is avoiding dynamic memory allocation as it is somewhat universal with ...
Seasickness asked 8/7, 2019 at 12:25

4

I need a library or a framework plugin that can draw charts that can be modified real-time by resizing part of the chart itself. Is there such thing? I plan to use it for adjusting the chart value...
Halflight asked 3/10, 2011 at 22:48

2

Solved

Once I have allocated the array, how do I manually free it? Is pointer arithmetic possible in unsafe mode? Like in C++: double *A=new double[1000]; double *p=A; int i; for(i=0; i<1000; i++) {...
Tee asked 21/12, 2015 at 15:37

2

Solved

What does the first parenthesis do? // TArray<struct FBatchedLine> BatchedLines; // declared in LineBatchComponent.h new(BatchedLines) FBatchedLine(Start, End, Color, LifeTime, Thickness, D...
Topsail asked 14/1, 2016 at 16:38

2

Solved

I'm trying to find memory issues in my app. When I use Xcode's debug navigator for memory issues I see increase in the overall usage of the application. For a specific flow, when I go back and fo...

1

Solved

I need to calculate entries of a vector whose length I do not know beforehand. How to do so efficiently? A trivial solution is to "grow" it: start with a small or empty vector and successively app...
Piscina asked 21/9, 2018 at 9:35

1

I have the following code to allocate buffer uns16 m_rawBuffer = new uns16[m_rawBufferSize]; pin_ptr<uns16> ptrAcqBuffer = m_rawBuffer; Although it is pin_ptr from time to time GC modifie...
Lulualaba asked 12/7, 2018 at 18:16

1

Solved

I want to use Hinnant's stack allocator (documentation, implementation) in combination with STL containers but I want to modify it such that dynamic memory allocation NEVER takes place. One thing...
Eighth asked 1/6, 2018 at 10:2

2

I have a question: what's the time complexity of realloc function? For example, I have an array of integers: a[10]. Of course, the array has been dynamically allocated in this way => int *a = (int...
Legwork asked 23/5, 2018 at 13:9

7

Solved

Many C code freeing pointers calls: if (p) free(p); But why? I thought C standard say the free function doesn't do anything given a NULL pointer. So why another explicit check?
Pitsaw asked 16/12, 2009 at 4:39

0

I am trying to use aligned_alloc in my C++ code but it fails to compile: cc1plus: warning: command line option '-std=c11' is valid for C/ObjC but not for C++ vec.cpp: In function 'int main()': vec...

1

I have the following script: typedef struct { uint8_t red; uint8_t green; uint8_t blue; } color; color c1; color* c2 = malloc(sizeof(color)); I would like to know where c1 and c2 are stored....
Ushaushant asked 6/1, 2018 at 20:25

1

Solved

I'm trying to decide which one of these two options would be the best: subroutine sqtrace( Msize, Matrix, Value ) integer, intent(in) :: Msize real*8, intent(in) :: Matrix(Msize, Msize) real*8,...
Equinox asked 20/12, 2017 at 20:19

1

Solved

Seems, that I found how to easily get normal 2D Array with contiguous memory in 2 lines of code: template<int N, int M> using Array2D = array<array<int, M>, N>; Let's solve eas...
Indamine asked 5/11, 2017 at 11:23

1

Solved

How can I further improve the performance of the code below while still maintaining the public interface: public interface IMapper<in TSource, in TDestination> { void Map(TSource source, TD...
Dowland asked 30/9, 2017 at 7:36

2

var testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" //var testString = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" func BenchmarkHashing900000000(b *testing.B){ var bufByte = bytes.Buffer{} ...
Sundsvall asked 24/7, 2016 at 17:28

7

Solved

The following code is generating a stack overflow error for me int main(int argc, char* argv[]) { int sieve[2000000]; return 0; } How do I get around this? I am using Turbo C++ but would like ...
Aloisius asked 21/2, 2009 at 2:10

1

Solved

I'm trying to understand the timings of malloc and free. So I wrote this simple program: #include <stdlib.h> #include <stdio.h> int main() { long i; for(i = 2; i < 10000000000...
Stanch asked 27/6, 2017 at 9:40

1

Solved

Unlike other languages, there seems no allocate or new syntax in Chapel for allocating arrays on the heap, but rather use the usual "declaration"-like syntax. For example, in the following code, I ...
Upsilon asked 6/6, 2017 at 1:52

5

Solved

I know this question title looks scary, but it isn't. Sorry! Ok, so, what's the point of creating a one-time-only/unchangeable "variable"? Lets say I have one property called "name" in a Person o...
Nip asked 11/2, 2017 at 3:48

2

Solved

After I am studying about allocator for a few days by reading some articles (cppreference and Are we out of memory) , I am confused about how to control a data-structure to allocate memory in a cer...
Ingham asked 29/1, 2017 at 13:17

1

Solved

Quoting the second paragraph of BUGS section, from manpage of alloca(3) On many systems alloca() cannot be used inside the list of arguments of a function call, because the stack space reserved...
Dorn asked 29/1, 2017 at 10:3

8

Solved

How to allocate dynamic memory for 2d array in function ? I tried this way: int main() { int m=4,n=3; int** arr; allocate_mem(&arr,n,m); } void allocate_mem(int*** arr,int n, int m) { *a...
Sexdecillion asked 25/2, 2013 at 8:19

3

Solved

I'm trying to figure out how much memory I can allocate before the allocation will fail. This simple C++ code allocates a buffer (of size 1024 bytes), assigns to the last five characters of ...
Prevailing asked 30/12, 2016 at 17:38

© 2022 - 2025 — McMap. All rights reserved.