IBM Support

PM48459: TTCN generated code causes memory leak (esc TLOG#66261)


You can track all active APARs for this component.

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 :
    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:
    prev_line = line;
    switch (line) {
    case 1:
    case 2:
    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
    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


APAR Information

  • APAR number


  • Reported component name


  • Reported component ID


  • Reported release


  • Status


  • PE




  • Special Attention


  • Submitted date


  • Closed date


  • Last modified date


  • 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


  • Fixed component ID


Applicable component levels

  • R630 PSN


Document information

More support for: Rational TTCN Suite

Software version: 6.3

Reference #: PM48459

Modified date: 09 January 2012

Translate this page: