WpFreeMem: Difference between revisions
Appearance
Created page with "{{DISPLAYTITLE:wpFreeMem}} 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 comple..." |
mNo edit summary |
||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
_wpFreeMem(somSelf, pByte) | _wpFreeMem(somSelf, pByte) | ||
==Parameters== | ==Parameters== | ||
;''somSelf'' ([[WPObject]] *) - input | ;''somSelf'' ([[WPObject]] *) - input:Pointer to the object on which the method is being invoked. | ||
:Pointer to the object on which the method is being invoked. | |||
:Points to an object of class WPObject. | :Points to an object of class WPObject. | ||
;''pByte'' ([[PBYTE]]) - input:Pointer to the memory to be de-allocated. | |||
;''pByte'' ([[PBYTE]]) - input | |||
:Pointer to the memory to be de-allocated. | |||
==Returns== | ==Returns== |
Latest revision as of 20:08, 1 September 2025
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 */ }