Highlighted
Absent Member.
Absent Member.
238 views

De-allocate Memory for Citrix Function

Hello Everyone

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().

0 Likes
1 Reply
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: De-allocate Memory for Citrix Function

Hi

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

char window_name[100];

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.

br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.