|
What are the differences among static, dynamic, and automatic allocation?
Answer Snippets (Read the full thread at stackoverflow):
Dynamic allocation is memory that is allocated as needed, and deallocated into a block, exists for duration of that....
Static allocation is memory that has been set aside for an application when it is first loaded the program is closed.
|
|
This question may sound fairly elemental, 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 ...
Started by Adam on
, 19 posts
by 19 people.
Answer Snippets (Read the full thread at stackoverflow):
I don't think....
Also, stack vs of objects.
Thus, in a tight loop, Stack Allocation was the way to go of heap allocation but that comes with a slight added complexity and its own headaches.
Cores so that the alloc doesn't conflict.
|
|
In java Can objects be created with both static memory allocation and dynamic memory allocation?
Answer Snippets (Read the full thread at stackoverflow):
Variables, or in static code blocks , are statically allocated, in the sense that allocation is done.
|
Ask your Facebook Friends
|
What are the advantages of using dynamic memory allocation to create an array compared to the ordinary allocation of elements in an array?
Started by Venus on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Dynamic memory allocation allows for lots of liberty when it comes to managing the lifecycle.
|
|
Would NTFS allocation blocks of 16KB or 32KB make compile time faster in comparison to the default 4KB?
Started by Brian R. Bondy on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The real answer, of course, can be found by measuring it... .
With the amount of caching a modern OS does, it seems unlikely to be significant .
I can't imagine that would make much of a difference - disk block size is pretty far removed from compile speed .
|
|
While studying C++ (and C) I had some particular doubts regarding the working of stack allocation, that I can't find a solution to:
Does stack allocation call malloc/free functions implicitly? If not; how does it assure there is no conflict between stack...
Started by Leafy on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Stack allocation....
Stack allocation doesn't.
The entire stack space is allocated at the start of your program for a "stack frame" which will be where your stack allocated variables reside.
allocation does not call malloc/free.
|
|
What is the difference between the 'delete' and 'dispose' C++ operators with regards to dynamic memory allocation?
Started by Brandon on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Dispose will give....
Delete will release the memory used to store the object; this memory returns to the heap and can be used for other storage requirements .
I'm assuming this is related to .NET managed C++ because standard C++ has no sense of "dispose" .
|
|
I'm just learning about dynamic memory allocation, but there is one thing i'd like to be explained.
One use for dynamic allocation is for dynamic sized arrays, and thats clear to me. Another use is for normal objects.
What is a situation one should use...
Started by Ikke on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You need dynamic allocation when you don't.
Be sure to use STL classes like std::vector, not "arrays" .
|
|
The sentence below is from, The Positive Legacy of C++ and Java by Bruce Eckel, about operator overloading in C++:
C++ has both stack allocation and heap allocation and you must overload your operators to handle all situations and not cause memory leaks...
Started by yesraaj on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
In C++ new and delete are both actually operators; if you choose to provide custom allocation behavior.
|
|
As far as I can tell, this is isn't possible, so I'm really just hoping for a left field undocumented allocation hook function. I want a way to track allocations like in _CrtSetAllocHook , but for C#/.net. The only visibility to the garbage collector/...
Started by Jurney on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Here is an MSDN link to the top level of the documentation: .NET Framework General Reference: About the Profiling... .
The CLR has a 'profiling API' that hooks into pretty much everything - it is what the commercial .NET memory profiling products use, I believe .
|