Login | Register   
LinkedIn
Google+
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 2

21-40 of 87     Previous     Next
Using the Volatile Keyword to Avoid Failures
by Yaron Mashav
When compiling a program, the compiler adds some optimizations that may cause your application to misbehave. For example consider the following ...
Reading Binary Data from an ifstream
by Danny Kalev
To read a binary value from an input file stream (ifstream) object, use the read() member function. read() takes two parameters: char * and long, which hold the address of the buffer to which the ...
How to Make Multi-segment Applications in Palm OS
by Shiv Kumar
In Palm OS, the memory chunk size is 64K. This means that a single segment like a code segment cannot be greater then 64K. To make applications larger than this, you have to split the ...
Detecting Memory Leaks in Palm OS
by Shiv Kumar
Memory is precious in Palm OS, so you can't afford any memory leaks in programs. Therefore, it's very essential to detect any memory leaks. To do this put breakpoints in the program where you ...
Using Memset On Class Objects
by Nitin Kumar
It's common practice in C, to do a memset on structures, in order to initialize all member variables to some default value, usually NULL. Similarly, you can use memset to initialize class objects.
New and Delete
by DevX Pro
In my class declaration I have a member: CSomeUsefulClass* m_one; In my implementation file, there is a function: DoMyThing() { CSomeUsefulClass* m_two; m_two = new CSomeUsefulClass(param1, param2); //blah... m_one = m_two; //do my thing... } then in the destructor of my class: if(m_one) delete m_one; Will this program cause a memory leak?
Free Store and Heap
by DevX Pro
Is there any difference between heap and free store in C++?
Static Memory or Heap?
by DevX Pro
When I creating a class, I declare several large arrays, and some integers within one of of class function members. Within main, I call new, making the object declared on the heap. Are the arrays and interges also delcared on the heap?
Hardcoded Char Arrays
by Danny Kalev
Does your C++ compiler accept the following ...
Memory Allocation
by DevX Pro
What is the reason that allocated memory should be explicitly deallocated ? Is there any difference in the way the data with different storage types (stack, heap, static memory) are stored ? In the following class: class thisClass { int i; public: thisclass (); }; Is there any reason to declare inside the class a pointer to int instead of int and then allocate memory for that pointer in the constructor?
Clarifying a Common Source of Pointer Confusion
by Danny Kalev
Novices, especially those who have experience with garbage-collected languages, are often confused with the concept of object deallocation and destruction in C++. They tend to explicitly invoke every ...
How to Delete Dynamically Allocated Multidimensional Arrays
by Danny Kalev
You can allocate a multidimensional array using new as ...
Understanding Stack Overflow
by Danny Kalev
The stack is a region of memory on which local automatic variables are created and function arguments are passed. The implementation allocates a default stack size per process. On modern operating ...
The Memory Layout of Members with Different Access Specifiers
by Danny Kalev
Consider the following two ...
Stack Unwinding in the Event of an Uncaught Exception
by Danny Kalev
When an exception is thrown and no matching handler can be found for it, C++ invokes the function terminate(). By default, terminates invokes the function abort(). Some compilers guarantee that at ...
The calloc() Function
by Danny Kalev
The standard C library declares the function calloc() in as ...
New & Malloc
by DevX Pro
I understand that most of the time, new and malloc may use the same allocation routines, but does that necessarily mean new calls malloc? I am asking because I want to see all the memory being allocated in my program, but I use both new and malloc. If it's possible, I would like to just overwrite malloc instead of both malloc and new.
What's Wrong with Inheriting from a Class that Has no Virtual Destructor?
by Danny Kalev
Classes having a non-virtual destructor aren't meant to be derived from (such classes are usually known as "concrete classes"). std::string, std::complex, and all STL containers are concrete classes. ...
Avoiding Buffer Overflows
by Danny Kalev
Buffer overflows are a fertile source of bugs and malicious attacks. They occur when a program attempts to write data past the end of a buffer. Consider this ...
Restrictions on Using Memcpy()
by Danny Kalev
You should use memcpy() only for copying POD (plain old data) types, but not class objects. For copying objects, use their assignment operator or the std::copy() algorithm. Remember also that the ...
21-40 of 87     Previous     Next
Sitemap