Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #522750] Tue, 23 March 2010 20:06 Go to next message
Patrick Geremia is currently offline Patrick GeremiaFriend
Messages: 79
Registered: July 2009
Member
Any idea how to fix the issue?
See below the output of the xdc .interfaces command

% xdc .interfaces

#
# making package.mak (because of package.bld) ...
/db/wisap/tools/ti/rtsc/xdctools_3_16_02_32/tconf -Dxdc.path=" /db/wisap/tools/ti/rtsc/xdctools_3_16_02_32/packages;../../. ./../.. " -Dxdc.root=/db/wisap/tools/ti/rtsc/xdctools_3_16_02_32 -Dxdc.hostOS=Linux -Dconfig.importPath=" .;/db/wisap/tools/ti/rtsc/xdctools_3_16_02_32/packages;../.. /../../..;/db/wisap/tools/ti/rtsc/xdctools_3_16_02_32;/db/wi sap/tools/ti/rtsc/xdctools_3_16_02_32/etc " -Dxdc.bld.targets="" -DTOOLS= /db/wisap/tools/ti/rtsc/xdctools_3_16_02_32/packages/xdc/bld /bld.js ./config.bld package.bld package.mak
Linux
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_on_debug_64P_le.a64P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_on_release_64P_le.a64P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_off_debug_64P_le.a64P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_off_release_64P_le.a64 P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_on_debug_64P_le.a64P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_on_release_64P_le.a64 P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_off_debug_64P_le.a64P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_off_release_64P_le.a6 4P
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_on_debug_64P_be.a64Pe
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_on_release_64P_be.a64P e
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_off_debug_64P_be.a64Pe
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_off_release_64P_be.a64 Pe
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_on_debug_64P_be.a64Pe
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_on_release_64P_be.a64 Pe
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_off_debug_64P_be.a64P e
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_off_release_64P_be.a6 4Pe
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_on_debug_i686_le.a86U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_on_release_i686_le.a86 U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_off_debug_i686_le.a86U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_on_trace_off_release_i686_le.a8 6U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_on_debug_i686_le.a86U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_on_release_i686_le.a8 6U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_off_debug_i686_le.a86 U
ArchiveGoal: ti_wbi_umts_rac_racfd_assert_off_trace_off_release_i686_le.a 86U
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
gmake: *** Deleting file `package.mak'
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #522970 is a reply to message #522750] Wed, 24 March 2010 16:20 Go to previous messageGo to next message
Amit Mookerjee is currently offline Amit MookerjeeFriend
Messages: 47
Registered: July 2009
Member
Hi Patrick,
Can you confirm if you are seeing the same issue as outlined in the bug ECL299076 ?

If so you will see the fix in the XDCtools 3.16.03 release.

Thanks
Amit
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #522976 is a reply to message #522970] Wed, 24 March 2010 16:34 Go to previous messageGo to next message
Patrick Geremia is currently offline Patrick GeremiaFriend
Messages: 79
Registered: July 2009
Member
I do not believe it is the same bug. I suspect the problem occurs because I have a large number of sources files when I build my library (462 to be precise). I did a quick test and by fakely reducing the number of files, it works fine.
Is there a way to increase the heap size by setting some options?
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #523070 is a reply to message #522976] Wed, 24 March 2010 23:19 Go to previous messageGo to next message
Amit Mookerjee is currently offline Amit MookerjeeFriend
Messages: 47
Registered: July 2009
Member
Patrick,
We need to reproduce this issue at our end. As indicated in a separate message we will have a call to-morrow morning (pacific time) to discuss this problem. Meanwhile can you upgrade to the latest release - XDCtools 3.16.03?

Thanks
Amit
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #523071 is a reply to message #522976] Wed, 24 March 2010 23:31 Go to previous messageGo to next message
Sasha Slijepcevic is currently offline Sasha SlijepcevicFriend
Messages: 115
Registered: July 2009
Senior Member
Patrick,
there is an internal variable that can help you increase the Java heap. It's a hack that should let you proceed until we figure out if it's a bug in XDCtools or we simply need a public support for adjusting the Java heap for package.bld processing.

So, in your shell you need to define the environment variable MK_BLDOPTS and set it to "--Xmx128m" for 128M of memory. Notice two '-' characters.
To verify that the Java heap size changes accordingly, add this line at the beginning of your package.bld file:
print(java.lang.Runtime.getRuntime().maxMemory());

Let me know if that works and how much memory you had to use for 462 source files.

Thanks,
Sasha
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #523089 is a reply to message #523071] Thu, 25 March 2010 01:22 Go to previous messageGo to next message
Jon Rowlands is currently offline Jon RowlandsFriend
Messages: 6
Registered: July 2009
Junior Member
For what it's worth, I tried to reproduce this but no luck so far. I created a package that generated 500 source files and used them to build ten libraries. This thread doesn't allow attachments, but I appended my package.bld below.

This is a stretch, but worth asking. Are you doing anything complex in your package.bld that could itself eat up heap space?

For example in my test I used java.io calls to synthesize the source files. I could imagine that maybe not closing these IO streams, or saving them in an array so that they couldn't be garbage collected, or something like that, could produce this behavior.

In any case, we'll continue to try to reproduce it.

Jon

/* compile for the first target configured in config.bld */
var target = Build.targets[0];

var letters = ['a','b','c','d','e','f','g','h','i','j'];
var digits = ['0','1','2','3','4','5','6','7','8','9'];
var quals = ['A','B','C','D','E'];

/* generate 500 dummy source files */
var sourcefiles = [];
for each (var letter in letters) {
    for each (var digit in digits) {
        for each (var qual in quals) {
            /* generate the source file name */
            var base = letter + digit + qual;
            var filename = base + '.c';
            sourcefiles.push(filename);

            /* mark the file as generated so that it gets cleaned */
            Pkg.generatedFiles.$add(filename);

            /* generate the contents */
            if (!java.io.File(filename).exists()) {
                var ps = java.io.PrintStream(filename);
                ps.println("int " + base + " = 1;");
                ps.close();
            }
        }
    }
}

/* generate ten libraries */
var libs = [];
for each (var letter in letters) {
    /* register the library */
    var libName = letter;
    var lib = Pkg.addLibrary(libName, target);

    /* add all the source files to the library */
    for each (var filename in sourcefiles) {
        lib.addObjects([filename]);
    }
}
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #523143 is a reply to message #523071] Thu, 25 March 2010 10:21 Go to previous messageGo to next message
Patrick Geremia is currently offline Patrick GeremiaFriend
Messages: 79
Registered: July 2009
Member
this fixes the problem. I used 128MiB as you specified.
Re: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space [message #523145 is a reply to message #523089] Thu, 25 March 2010 10:29 Go to previous message
Patrick Geremia is currently offline Patrick GeremiaFriend
Messages: 79
Registered: July 2009
Member
I am not doing anything special. Below is my package.bld script

function listFiles(ext, dir)
{	
    var srcFile = [];
    var d;

    if (dir == undefined) 
	    d = ".";
    else 
    	d = dir;

    /* Get access to the current directory. */
    var file = new java.io.File(d);

    /* Check if the file exists and it is a directory. */
    if (file.exists() && file.isDirectory()) 
    {
        /* Get a list of all files in the specific directory. */
        var fileList = file.listFiles();
        for (var i = 0; i < fileList.length; i++) 
        {
            /* Dont add the generated directory 'package' and any of its files 
             * to the list here. */
            if (fileList[i].getName().matches("package") == false)
            {
                /* Check if the detected file is a directory and if so we need to 
                 * recursivly detect all the files within that directory too. */
                if (fileList[i].isDirectory())
                {
                    /* Generate the directory Name in which we will recurse. */ 
                    var directoryName = d + "/" + fileList[i].getName();

                    /* Get a list of all files in this directory */
                    var fileListing = listFiles (ext, directoryName);
                    if (fileListing != null)
                    {
                        /* Return a list of all file names in the directory. */
                        for (var j = 0 ; j < fileListing.length; j++) 
                            srcFile[srcFile.length++] = fileListing[j];
                    }
                }
                else
                {
                    /* This was a file. Check if the file name matches the extension */
                    if (fileList[i].getName().endsWith(ext) == true)
                        srcFile[srcFile.length++] = d + "/" + fileList[i].getName();
                }
            }
        }
        return srcFile;
    }
    return null;
}

function modBuild()
{
    var pkg = Pkg;

    var srcDir = "src"

    var srcFiles = listFiles("c",srcDir);

    var library = xdc.useModule('xdc.bld.Library');
    var libAttrs = new library.Attrs; 

    /* Build the libraries for all the targets specified. */
    for (var target=0; target < build.targets.length; target++)
    {
		var endian = build.targets[target].model.endian;
		if (endian=="little")
		{
			endian="le";
		}
		else
		{
			endian="be";
		}
		var isa = build.targets[target].isa
		var pkgName = pkg.name.replace(/\./g, "_");

		for (var profile in build.targets[target].profiles)
	 	{	
			if (profile.search(pkgName)!=-1)
			{
				libAttrs.profile=profile;
				var name = libAttrs.profile + "_" + isa + "_" + endian;
				libAttrs.copts="";
				if ((build.targets[target].name == "C64P_big_endian") ||
					 (build.targets[target].name == "C64P"))
				{
					libAttrs.copts += "-fb=./" + pkg.libDir + name + "/" + srcDir + " ";
					libAttrs.copts += "-ft=./" + pkg.libDir + name + "/" + srcDir + " ";
					libAttrs.copts += "-ff=./" + pkg.libDir + name + "/" + srcDir + " ";
				}
				var lib = pkg.addLibrary(name, build.targets[target], libAttrs);
				lib.addObjects (srcFiles);
				print ("ArchiveGoal: " + lib.name + lib.attrs.suffix); 
			}
		}
    }
}

modBuild();


Previous Topic:crash when using the CDOC reference help system
Next Topic:Memory.staticPlace() problem
Goto Forum:
  


Current Time: Sat Nov 09 01:21:42 GMT 2024

Powered by FUDForum. Page generated in 0.04748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top