[sqlunit] Java heap space

  • Jason

    Jason - 2008-08-06

    I'm trying to run a test for a single stored procedure but it looks like it completes and then hangs for awhile before running out of memory.  Any idea what I should try to fix it?  I tried increasing the value in ANT_OPTS to a gig but that didn't help.  Also, the stored proc only takes about 2 secs to complete manually and returns ~40K rows.  The test completes if no rows are returned or if I replace the proc's body with SELECT 1.  It seems like the number of rows is the culprit but I don't see why.  I'm going to experiment with other row counts.

    Here's more detail:

    [sqlunit] *** Running SQLUnit file: C:\acme\StoredProcTests\tests\generated\GetAllInstruments.xml
    [sqlunit] Getting connection(1)
    [sqlunit] Getting connection(2)
    [sqlunit] Setting up test...
    [sqlunit] Running diff[1]: sp_GetAllInstruments_0 (0ms)
    [sqlunit] Java heap space
    [sqlunit] Tearing down test...
    [sqlunit] sqlunit-ant: SQLUnit Tests Failed: In file: C:\acme\StoredProcTests\tests\generated\GetAllInstruments.xml, tests: 1, failures: 1, errors = 0

    Performance Stats:
    VM Size: 256MB
    Peak Memory Usage: 80MB
    CPU: Fluctuates between 75-100% and then goes to 0% for many minutes and eventually fails. 

    Microsoft Windows XP [Version 5.1.2600]
    Apache Ant version 1.7.0 compiled on December 13 2006
    java version "1.6.0_10-beta"
    Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b23)
    Java HotSpot(TM) Client VM (build 11.0-b11, mixed mode, sharing)

    Envrionment Variables:
    ANT_OPTS=-Xms256m -Xmx1024m

    • Jason

      Jason - 2008-08-06

      Other Environment Details:
      Database is SQL Server 2005.
      Each row is pretty small as it's just 5 int columns. 

      So when I modify the stored procedure to only return the TOP 100 things behave better.  The Peak memory for Java goes to 256MB and the test completes.  Unfortunately, the expected result set has around 40K rows so the test fails since now the actual only has 100 rows.  So it seems pretty clear that the problem is a combo between memory usage and the number of rows returned.  I'm going to keep playing with the memory settings, but memory usage seems pretty excessive.

    • Jason

      Jason - 2008-08-06

      So now it magically works with the original stored procedure with all 40K rows. It's scary that all I changed was the SQL but I guess my issue is gone, even if only for now...

    • Sujit Pal

      Sujit Pal - 2008-08-06

      With diff, as far as I remember, it copies the two resultsets into 2 objects and compares them in memory. So I guess you may have to up your -Xmx like you did. Not sure though, it was a while ago...



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks