|
Dispose procedure
----------------------------------------------------------------
Declaration:
procedure Dispose ( var P : Pointer [, Destructor] );
Example:
type
PString = ^String;
var
S : PString;
...
New( S );
S^:='Goodbye World!'';
Dispose (S);
Purpose:
Deallocates the dynamic memory allocation used by the item or object
pointed to by parameter variable P. When disposing of objects (see chapter 5,
"Object Oriented Programming"), an optional second parameter may specify the
name of the destructor method for the object pointed to by P. When used in
this form, Dispose first calls the destructor method of the object prior to
deallocating the the memory pointed to by P.
Important!
After calling Dispose, the value of P is no longer valid. A commom
programming error is to continue using a pointer after it has been deallocated.
Because the pointer may still point to the original location in memory where
the object had been allocated and since that memory may not be immediately
claimed for use by another entity, this will sometimes work temporarily.
However, to do so is a serious programming error and may cause the program to
crash! Don't do it!
When calling Dispose, P must be a valid pointer. If P does not point to
the memory used by the heap system, Dispose will issue a run-time error and
stop execution of the program.
See FreeMem, GetMem, Mark, New, Release
Add by Pancho
You can edit it here
|
|
Adding comments is available only for registered users.
|
Latest "Green" Packing Material? Mushrooms!
A new packing material that grows itself is now appearing in shipped products across the country. The composite of inedible agricultural waste and mushroom roots is called Mycobond™, and its manufacture requires just one eighth the energy and one tenth the carbon dioxide of traditional foam packing material. And unlike most foam substitutes, when no longer useful, it makes great compost in the garden. The technology was the brainchild of two former Rensselaer ...
More at http://www.nsf.gov/news/news_summ.jsp?cntn_id=117385&WT.mc_id=USNSF_51&WT.mc_ev=click
This is an NSF News item.
|
|
PycckaR BepcuR
Articles

Library

Downloads

|