While executing scripts in batch mode in RFT, during this long run, sometimes you might encounter the below error
Invalid Spy Memory reference: Heap#=5 blockId=0x000825f0 uid=0x00000cf1
In my experience, there are a couple of ways you can try to resolve this. During playback, you can try following the below procedures in an RFT script. An alternative is to use a test machine to increase heap size, find those
Functional Test Script:
1. Unregister the test objects used in the scripts, once the scope of the test object ends.
This can be achieved by calling unregisterAll() API at the end of each test scripts.
Refer the techhote 1507963 which explains about the usage of unregisterAll() method in RFT
2. Use the cleanup() API in each script to clear the Garbage collector data. This API also can be called at the end of each script.
On a Test Machine:
1. Close RFT and make sure there are no Javaw.exe processes running in the task manager.
2. Go to Start > Run > %temp% and clear all the temp contents.
3. Go to the Workspace directory and take a backup of the .metadata folder (if it exists) and delete it.
4. Increase Spy Heap Memory in registry editor:
Add a DWORD in registry to increase the SpyHeapSize. (Refer technote 1318359)
5. Increase JVM heap size in the eclipse.ini file present in RFT installaton directory located in C:\Program Files (x86)\IBM\SDP\ folder.
(for example increase it to 2044) -Xmx2044m
(Default value would be -Xmx1024m, make sure that your machine has enough memory to increase the JVM heap size)
6. Set a clean initialization of RFT by adding the -clean switch in the shortcut Properties of Eclipse Scripting.
Go to Start > All Programs> IBM Software Delivery Platform > IBM Rational Functional Tester > Right Click on Eclipse Scripting> Properties, append the target with -clean as below:
"C:\Program Files (x86)\IBM\SDP\eclipse.exe" -product com.ibm.rational.rft.product.ide -clean
7. Restart the machine and trigger the playback again