» Home » allocation » Page 1
design class aggregation - stack allocation vs dynamic memory allocation
Category : Programming Languages

Please have a look at the two simplified examples of designing a class aggregation below.


Solution 1


Header


// need include, forward declaration is not enough
#include "door.h"
class CGarage
{
public:
CGarage(const std::string &val);
private:
CDoor m_door;
};

Source


#in

View Replies


C++ Which is faster: Stack allocation or Heap allocation
Category : Network & Servers

This question may sound fairly elementary, but this is a debate I had with another developer I work with.


I was taking care to stack allocate things where I could, instead of heap allocating them. He was talking to me and watching over my shoulder and commented that it wasn't necessary because they are the same performance wise.


I was always under the impression that gro


View Replies


C# Memory allocation/de-allocation question regarding scope
Category : Programming Languages

I was recently going through a garbage collection article and decided to play along and attempt to gain a greater understanding. I coded the following, playing around with the using statement, but was surprised with the results... I expected e.Parent.Name outside of the using block to go ka-blooey.


What exactly is going on here?


static void Main(string[]

View Replies


C++ Object Block Allocation vs Individual Allocation
Category : Network & Servers

what is the major difference with block allocation vs individual object allocation. let say


int iCount = 5;
int i = 0;
while(i < iCount)
{
f = new foo();
i++;
}
//////////////////
foo* f = new foo[iCount];

will that second method save some memory space for me?.
i heard that every object we allocated surround


View Replies


In java Can objects be created with both static memory allocation and dynamic memory allocation?
Category : Java

In java Can objects be created with both static memory allocation and dynamic memory allocation?


View Replies


What Is Tip Allocation?
Category : Personal Finance
Certain businesses in the food service industry whose employees regularly receive tips must ensure that these tips meet certain requirements, and reimburse their employees if they do not. This is called tip allocation. Businesses AffectedTip allocation is required for any business classified as a "large food or beverage establishment." The IRS defines such an establishment as any food or bevera

View Replies

TAGS : What Allocation

g++ register allocation
Category : Programming Languages

Is there a safe way in g++ to force a variable to be in a certain register when a function is called? This function contains inline-asm-code that assumes inputs in certain registers.


I tried to declare local variables to be in fixed registers (register int x asm ("$10")) and pass them to the function, but -O3 messes it up.


I don't want to reserv


View Replies


C++ allocation segfault
Category : Development Tools & Services

I have this code:


size_t count = new_data.size();
std::cout << "got the count: " << count << std::endl;
double g_x[count];
std::cout << "First array done
";
double g_y[count];
std::cout << "Allocated array of size" << count << std::endl;

which gives me the output:


got the c

View Replies


For what do we need storage allocation?
Category : Programming Languages

for what do we actually require manual storage allocation?


The only possible tasks which I could think about would be for bigger binary data which does not fit to a 32bit integer.


Is this correct?
What are other use cases?


View Replies


Function allocation
Category : Programming Languages

Where are functions stored in a C++ program?


For example


int abc()
{
//where am I stored?
}

I know that we can take the address of a function, that means functions are stored somewhere in memory. But I have already read at many places that no memory allocation for functions takes place.


I am confused. My question ma


View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .