![]() They can be implemented in many different ways, and the terms apply to the basic concepts. The most important point is that heap and stack are generic terms for ways in which memory can be allocated. }//<- oops there's a memory leak, I should have called delete pBuffer }//<- buffer is deallocated here, pBuffer is not You would use the heap if you don't know exactly how much data you will need at run time or if you need to allocate a lot of data.Ĭhar *pBuffer //Can have allocation failures if too big of a buffer is requested to be allocated.In C++ or C, data created on the heap will be pointed to by pointers and allocated with new or malloc respectively. ![]() Can have fragmentation when there are a lot of allocations and deallocations.Used on demand to allocate a block of data for use by the program. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |