De-allocate Memory for Citrix Function
I am working with Citrix protocol (HP LoadRunner). In my script i am using ctrx_get_window_name() function to retrieve window name. The function is used inside a for loop and might burn out my LG memory, i want to de-allocate the memory now. I used free() function to de-allocate the memory, it has no issues in vugen but when i replay the script in performance center it kills the mdrv process causing my users to fail, if comment the free() function script is passing without any issue in PC. Please let me know how to de-allocate memory for ctrx_get_window_name().
Re: De-allocate Memory for Citrix Function
You can NEVER use free() on memory that is not allocated manually, like with alloc() or malloc(). It will give the symptoms described and is expected.
Normally the memory allocated by builtin functions of LoadRunner is handled automatically after each iteration, and do not to be considered if not very special cases. This could be very extence use or very big size.
Now I'm curious why it is only this function that you are worried about. Is it the text in the function reference?
Use ctrx_get_window_name to retrieve the title of the window currently in focus.
It is up to the user to allocate memory space for buffer before ctrx_get_window_name is invoked and to de-allocate the memory when no longer in use.
But this only mean that the memory not will be allocated for you. If you declare the buffer like this
Then you will not allocate more than 100 chars and wil use the same space the whole time. You will not allocate new memory in the loop and there is no need for de-allocating memory.
Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.