stack-allocation Questions

1

I have the following piece of code: extern void func1(char *array); extern void func2(char *array); void myfunction(void) { if (somecondition) { char var2[256]; func2(var2); } if (someotherco...
Depravity asked 12/9, 2022 at 17:45

3

As my usually used C++ compilers allow variable-length arrays (e.g. arrays depending on runtime size), I wonder if there is something like std::array with variable size? Of course std::vector is of...
Poeticize asked 31/12, 2013 at 12:42

1

Solved

Consider the following example: struct vector { int size() const; bool empty() const; }; bool vector::empty() const { return size() == 0; } The generated assembly code for vector::empty (by ...

1

Solved

Since somewhere around Java 6, the Hotspot JVM can do escape analysis and allocate non-escaping objects on the stack instead of on the garbage collected heap. This results in a speedup of the...

3

Solved

I am porting some C99 code that makes heavy use of variable length arrays (VLA) to C++. I replaced the VLAs (stack allocation) with an array class that allocates memory on the heap. The performanc...

7

Solved

In a project about a decade ago, we found that std::vector's dynamic allocations caused a serious performance drain. In this case it was many small vectors allocated, so the quick solution was to w...
Chil asked 14/10, 2014 at 8:47
1

© 2022 - 2024 — McMap. All rights reserved.