IPB_Session interface:
ReleaseValue method
Description
Frees the IPB_Value acquired using AcquireValue or AcquireArrayItemValue.
Syntax
ReleaseValue(IPB_Value* value)
Argument |
Description |
---|---|
value |
The string to be released from memory |
Return Values
None.
Examples
The AcquireValue method is used to obtain a message argument value. Later, when the value is no longer needed, it is released using ReleaseValue to avoid memory leaks:
// Acquire a value
MessageArg = session->AcquireValue
( ci->pArgs->GetAt(0) );
pbstring pbMessage = MessageArg->GetString() ;
Message = (LPSTR)session->GetString(pbMessage) ;
...
// Cleanup phase
if (MessageArg)
{
Session->ReleaseValue ( MessageArg ) ;
}
Usage
When you no longer need the data acquired using the AcquireValue or AcquireArrayItemValue method, you must call the ReleaseValue method to free the data. Failing to do so causes a memory leak.
Do not use ReleaseValue to release a value that was not acquired using AcquireValue or AcquireArrayItemValue. If you do, the PowerBuilder VM might crash.