APAR status
Closed as program error.
Error description
TTCN generated code causes memory leak.
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: * **************************************************************** * PROBLEM DESCRIPTION: * **************************************************************** * RECOMMENDATION: * **************************************************************** Memory leaks can occur when allocating permanent memory when defining TTCN User defined operations.
Problem conclusion
Documentation on how to use permanent memory has been added to help: The following comment has been added to TTCN Suite documentation into the chapter TTCN Suite Methodology Guidelines --? 1 The TTCN Introduction --? TTCN Expressions --? TTCN Operations --? User Defined Operations : Note: Since TTCN Suite operations are implemented manually with the means of target language, pay careful attention to the way memory is allocated/freed inside an operation. There are 2 types of memory TTCN runtime is using: permanent memory and temporary memory. Permanent memory is used for permanent test case entities (like variables) that live longer than one step(one line) of a test case, temporary memory is used for temporary values that are created during execution of one step of a test case. Temporary memory is automatically released after execution of each line of a test case: IcGetTemporaryMemoryStart(?tmpmem_mark); prev_line = line; switch (line) { case 1: ... case 2: ... } ... IcReleaseTemporaryMemory(tmpmem_mark); IcGetTemporaryMemoryStart(?tmpmem_mark) is called before line execution, IcReleaseTemporaryMemory(tmpmem_mark) is called after line execution. Temporary memory is a preallocated memory buffer. void* VCMALLOC(unsigned int size, Bool temporary) function has got a parameter "Bool temporary" that says if allocated memory should be acquired from the preallocated memory buffer. If it is GcFALSE the system allocation function malloc will be called to create new memory. void VCFREE(void* ptr) deallocates allocated memory, but if the memory is temporary the function will do nothing. There is a Bool IcIsTemporary(void* pointer) predicate that checks if a pointer is in the temporary heap. void IcGetTemporaryMemoryStart(IcTmpMemMark *mark) and void IcReleaseTemporaryMemory(IcTmpMemMark pos) functions are used to save the position in temporary memory heap and sometime later release all memory acquired after that position. Test Suite Operation parameters are passed by value and all parameters are allocated in temporary memory during operation call. If an operation returns some value to the test suite, it is also expected to be allocated in temporary memory. Returned value is assigned to some further value, and it is not freed with a separate command. For example, test suite operation that converts a hex string to bit string should create the result value like this: result = VcMkTempValue(GcBITSTRINGD); EGciSetSTRING(result, bstr); Using GciMkBIT_STRING(bstr) function for creating return value will lead to memory leaks, because the value will be allocated in permanent memory and it will not be automatically freed.
Temporary fix
Comments
APAR Information
APAR number
PM48459
Reported component name
TLOGIC TTCN SUI
Reported component ID
5724V78TT
Reported release
630
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-09-21
Closed date
2012-01-09
Last modified date
2012-01-09
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
TLOGIC TTCN SUI
Fixed component ID
5724V78TT
Applicable component levels
R630 PSN
UP
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSYQKV","label":"Rational TTCN Suite"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
09 January 2012