58 Do not allocate memory and expect that someone else will deallocate it later. Always assign a new value to a pointer that points to deallocated memory. In C malloc , realloc and free are used to allocate memory dynamically on the heap. Thus, avoid whenever possible the use of malloc, realloc and free. If an array a having a type T is allocated, it is important to invoke delete in the correct way.
Static data can cause several problems.
In an environment where parallel threads execute simultaneously, they can make the behaviour of code unpredictable, since functions having static data are not reentrant. The latter means that a new instance of the constant object is created each time a file includes the file which contains the declaration of the object, unless the variable is explicitly declared extern in the include file. Static constants that are defined within a class are always external and must always be defined separately. It may, at times, be tempting to allocate memory for an object using new , expecting someone else to deallocate the memory. For instance, a function can allocate memory for an object which is then returned to the user as the return value for the function.