wpFreeMem
Appearance
This instance method is called to de-allocate memory allocated by a call to wpAllocMem.
Syntax
_wpFreeMem(somSelf, pByte)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
- pByte (PBYTE) - input
- Pointer to the memory to be de-allocated.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion.
- FALSE: Error occurred.
Remarks
This method de-allocates memory for an object. **wpFreeMem** should always be called when the memory allocated by wpAllocMem is no longer needed.
Usage
This method should be called when the memory allocated by a call to wpAllocMem is no longer needed.
How to Override
This method should be overriden only to provide the de-allocation of memory allocated by an override method of wpAllocMem.
Example Code
This example clears up memory that was allocated on **wpInitData**.
SOM_Scope void SOMLINK myf_wpUnInitData(MYFILE *somSelf) { MYFILEData *somThis = MYFILEGetData(somSelf); MYFILEMethodDebug("MYFILE","myf_wpUnInitData"); if (_pszLastWorker) { _wpFreeMem(somSelf, (PBYTE)_pszLastWorker); /* Free this area */ } parent_wpUnInitData(somSelf); /* Call parent method last */ }