18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Java Heap Space Error in Batch Run
Hi Narayan,
I am scheduling about 150 sahi scripts in batch mode.
Getting java heap space error after every 48 - 50 sahi scripts run.
Also I have edited sahi.bat -
java -Xms128m -Xmx128m -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
Kindly suggest any solution.
I am scheduling about 150 sahi scripts in batch mode.
Getting java heap space error after every 48 - 50 sahi scripts run.
Also I have edited sahi.bat -
java -Xms128m -Xmx128m -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
Kindly suggest any solution.
Comments
You could increase the memory further. Generally Sahi does not need that much memory. It could be some particular script that is causing the problem.
Regards,
Narayan
I have increased memory to 512, but still after 47 - 50 scripts, error comes both in Firefox and Chrome.
I have noticed that after every script is run memory usage increases.
Following is the log of the error -
[java] Exception in thread "Thread-34951" java.lang.OutOfMemoryError: Java
heap space
[java] Nov 2, 2010 5:15:20 PM net.sf.sahi.test.ProcessHelper execute
[java] INFO: "C://Documents and Settings//qtp20//Local Settings//Applicatio
n Data//Google//Chrome//Application//chrome.exe" --user-data-dir=D:/sahi\userdat
a\browser\chrome\profiles\sahi4 --proxy-server=localhost:9999 --disable-popup-bl
ocking "http://sahi.example.com/_s_/dyn/Player_auto?file=D:\sahiAutomation%5
Csahiscript%5Csahi10183DefectPulledCurrentOwnerNotSet.sah__SahiAmpersandSahi__st
artUrl=http%3A%2F%2Fkanban%3A8080%2Fdigite-war%2FWelcome.do__SahiAmpersandSahi__
sahisid=sahi_ae5164f209c9404fa8082890d808c58e4a39sahixe2587d7400a42048cf0a1c40be
c0243295e9x"
[java] Nov 2, 2010 5:15:21 PM net.sf.sahi.test.ProcessHelper$PIDGatherer ru
n
[java] INFO: PIDs: [5996, 15232]; 1078 ms
[java] Exception in thread "Thread-35177" java.lang.OutOfMemoryError: Java
heap space
[java] Exception in thread "Thread-34088" java.lang.OutOfMemoryError: Java
heap space
[java] Exception in thread "Thread-32428" java.lang.OutOfMemoryError: Java
heap space
[java] Nov 2, 2010 5:15:27 PM net.sf.sahi.command.CommandExecuter execute
[java] WARNING: commandClass = >net.sf.sahi.command.Player< commandMethod =
>getCurrentStep<
[java] Exception in thread "pool-1-thread-20" java.lang.OutOfMemoryError: J
ava heap space
[java] Exception in thread "pool-1-thread-28" java.lang.OutOfMemoryError: J
ava heap space
[java] Exception in thread "Thread-35175" java.lang.OutOfMemoryError: Java
heap space
[java] Exception in thread "pool-1-thread-30" java.lang.OutOfMemoryError: J
ava heap space
[java] Exception in thread "pool-1-thread-27" java.lang.OutOfMemoryError: J
ava heap space
[java] Killing
erNotSet.sah
[java] Nov 2, 2010 5:15:40 PM net.sf.sahi.test.ProcessHelper kill
[java] INFO: Kill: [5996, 15232]
[java] #### Running Script:
tOnBoard.sah
[java] Exception in thread "Thread-35159" java.lang.OutOfMemoryError: Java
heap space
[java] Killing
efect.sah
[java] Nov 2, 2010 5:16:17 PM net.sf.sahi.test.ProcessHelper kill
[java] INFO: Kill: [17496, 22168]
[java] Exception in thread "Thread-7" java.lang.OutOfMemoryError: Java heap
space
[java] Exception in thread "Thread-34217" java.lang.OutOfMemoryError: Java
heap space
[java] Killing
Content.sah
[java] Nov 2, 2010 5:16:38 PM net.sf.sahi.test.ProcessHelper kill
[java] INFO: Kill: [14828, 15928]
[java] Killing
form.sah
[java] Nov 2, 2010 5:17:56 PM net.sf.sahi.test.ProcessHelper kill
[java] INFO: Kill: [7544, 22420]
We are still facing the following issues: -
1. JVM is not picking up the parameters which I had set in sahi.bat
2. The heap usage increase with more and more scripts running
Can u please suggest a solution for these issues. I have logged my observations for the second issue in an excel if required I will forward you this document.
1) You will have to specify how you are passing the parameters. What is the current heapsize?
2) In your scripts are you storing something in memory or declaring large variables in the global scope?
It would be good if you emailed the excel sheet to support@sahi.co.in
Regards,
Narayan
I have emailed Files.zip which contains
1. sahi.bat.txt
2. There is one Folder Script Example which contains a script along with required code files
3. Also sahimonitor.csv in which memory usage is given during batch run