← Back to team overview

sikuli-driver team mailing list archive

[Question #242343]: OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space

 

New question #242343 on Sikuli:
https://answers.launchpad.net/sikuli/+question/242343

Hi,

I'm working with Inter-process communication over the network between Powershell and Python.
I have a NamedPipeServer running in Powershell and have a Python NamedClient for the same to read the stream from the Pipe.

The NamedPipeClient code goes like this:

########################################################################
import struct
import time

def namedpipeClient():
    f = open(r'\\192.168.173.231\pipe\testpipe', 'r+b', 0)
    i = 1
    n = struct.unpack('I', f.read(4))[0]    # Read str length
    s = f.read(n)                           # Read str
    f.seek(0)                               # Important!!!
    print 'Read:', s
    if (s is None):
        return False
    else:
        return True
    time.sleep(2)

readyToProceed = namedpipeClient()

#############################################################################

If I start the namedpipeServer in Powershell, and then try to run the namedpipeClient from a normal Python IDLE(the code above), it is working fine, reads the content from the NamedPipe without any issue.

But the same method namedpipeClient(), when I move to Sikuli inside the setUp of one unittest, things changed and it is throwing me an Out of Memory Exception:

ft1.1: Inside Setup
Traceback (most recent call last):
  File "D:\MyWorkSpace\AViewSmokeTests_NP\src\AViewSmokeTests.sikuli\AViewSmokeTests.py", line 259, in setUp
    readyToProceed = namedpipeClient()
  File "D:\MyWorkSpace\AViewSmokeTests_NP\src\AViewSmokeTests.sikuli\AViewSmokeTests.py", line 68, in namedpipeClient
    s = f.read(n)                           # Read str
OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space


That code snippet in mySikuli script goes like this:

########################################################################
from sikuli.Sikuli import *
import struct
import os
import unittest
import HTMLTestRunner 
reload(HTMLTestRunner)

# All the ImagePath settings goes here.
#
# Path where report gets created using HTMLTestRunner, etc
#

#The namedPipeClient to read from the NamedPipe
def namedpipeClient():
    f = open(r'\\192.168.173.231\pipe\testpipe', 'r+b', 0)
    i = 1
    n = struct.unpack('I', f.read(4))[0]    # Read str length
    s = f.read(n)                           # Read str
    f.seek(0)                               # Important!!!
    print 'Read:', s
    if (s is None):
        return False
    else:
        return True
    time.sleep(2)

class Test1(unittest.TestCase, CommonMethods):
    def setUp(self):
        print "Inside Setup"
        readyToProceed = namedpipeClient()
    def  testA(self):
        pass
    def testB(self):
        pass
    def tearDown(self):
        pass
       
suite = unittest.TestLoader().loadTestsFromTestCase(AViewTest1)
runner.run(suite)

os._exit()

#########################################################################

Is it really an Out of memory Error ? or something wrong with my code(if yes, then why is it working fine when I run it as a simple Python program)?

Sikuli version : Sikuli 1.0.1
Java: jdk1.6
using: -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine [ in runScript.cmd]
Im running the script through command line only.


Thanks,
Aravind



-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.