Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
Search the Tips
Tip Bank > Application Design > Memory Management

Memory Management - Page 3

41-60 of 87     Previous     Next
Ruminations on Garbage Collection
by Danny Kalev
Many programmers think of automatic garbage collection (GC) as the Holy ...
Heap Issue
by DevX Pro
I have a class A (from a DllA) inside a method that does a new on a class B defined in the DllB, uses it and deletes it. When the destructor of the class B is invoked, a crash occurs. The class B keeps pointers on classes from a DllC and deletes them in the destructor. I get an error related to heap management. The assert is in dbgheap.c: _ASSERTE(_CrtIsValidHeapPointer(pUserData)); What is wrong in this configuration?
Better Alternatives to a Custom Memory Manager
by Danny Kalev
Some applications have special memory requirements. For example, they allocate large amounts of memory at once and then use it in parts, or they allocate only objects of the same type during their ...
Models of Garbage Collectors
by Danny Kalev
If you need a garbage collector, you can either install one or implement it by yourself. Which type of garbage collection should you use? A conservative garbage collector and a copying garbage ...
Preventing Memory Fragmentation
by Danny Kalev
Applications that are free from memory leaks but perform dynamic memory allocation and deallocation frequently tend to show gradual performance degradation if they are kept running for long periods. ...
Avoid Obsolete Win16 Memory Functions
by Danny Kalev
The 16-bit operating systems Windows 3.1x and DOS had a very intricate memory model that required the use of functions like GlobalAlloc() and GlobalLock(). These functions addressed a specific ...
Memory Deallocation
by DevX Pro
I have a byte pointer pointing to a message buffer. I want to know how can I delete just the first two bytes of this message and pass on the rest of the message to the application. If I simply pass on a shifted pointer pointing to the third byte, the application gets an error, when deleting the shifted message pointer, which says that there is a memory leak (which must be the first two bytes). My trouble is that I am also not allowed to copy the message from third bytes on to another buffer. How should I get rid of first two bytes ?
C-Style Function Pointers
by DevX Pro
While trying to port some C code to a C++ implementation, I ran into this problem. The module this came out of was designed to "automate data handling used to free and allocate memory as needed." When compiling the legacy code in VC++ (it was compilable with WATCOM C/C++ 11.0), I got a function pointer for allocs from a memory management module that looks like this: void *(*gAlloc)(size_t size); It generates this error: i:\sponline\src\mdc.cpp(18) : error C2040: 'gAlloc' : 'void *(*)(unsigned int)' differs in levels of indirection from 'void (*)(unsigned int)' I understand the "size_t" attribute is out of string.h, but I've never run into a case of "levels of indirection." Does this mean that in C++ you can't have "void *(*..."?
New Versus Malloc()
by DevX Pro
Why is it necessary to typecast the return value of malloc() but not for the new operator? This question has been asked of many C++ experts but no one has given me a convincing answer.
Segmentation Fault
by DevX Pro
What is a segmentation fault? I get it when I try to output an integer. (It's a very basic program: it reads in an integer and spits it back out.)
Heap or Free-Store?
by Danny Kalev
The terms heap and free-store are used interchangeably when referring to dynamically allocated objects. Are there any differences between the two? ...
Dynamic Memory Allocations and Thread Safety
by Danny Kalev
< ...
Memory Leaks and Their Prevention
by Danny Kalev
< ...
Malloc and Free
by DevX Pro
If I use malloc locally in a function do I have to use free as well? Won't some other piece of the application eventually chew up the memory I mallocd, so it doesn't matter what happens to it when I'm done with it in my function?
Don't Confuse delete With delete []
by Danny Kalev
< ...
Iostream Objects' Memory Use
by DevX Pro
I have written this very small program in Microsoft Visual C++ and it seems that STL is dumping memory: #include #include using namespace std ; void main() { _CrtDumpMemoryLeaks( ); } The output is a memory dump of 33 bytes and 40 bytes. How can this be?
Purpose of Placement delete
by Danny Kalev
...
Memory Stack vs. Free Store
by DevX Pro
When using C++, is it better to use stack or free store memory for data objects of medium to large size? I have multiplatform concerns on the answer. The app will run on Solaris, Linux, and Windows NT.
Understanding Memory Pages and Page Alignment
by Danny Kalev
System memory is divided into units that are called "pages". A page consists of 4,096 bytes (4K) on Intel architectures, and on Alpha systems it consists of 8,192 bytes (8K). A memory address is said ...
Efficient Array Copying
by Danny Kalev
Suppose you want to assign the contents of a two-dimensional array to another two-dimensional array: ...
41-60 of 87     Previous     Next
Sitemap