Jump to content

wpFreeMem

From EDM2
Revision as of 19:46, 1 September 2025 by Martini (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 */

}

Related Methods