This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243960 - OutOfMemoryError in code model tests
Summary: OutOfMemoryError in code model tests
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0
Hardware: All All
: P2 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-21 09:46 UTC by Vladimir Kvashin
Modified: 2014-04-24 02:05 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
possible fix (10.01 KB, patch)
2014-04-21 20:12 UTC, Vladimir Kvashin
Details | Diff
The same fix with minor improvements and all tests passed (just in case, to have a safe and easy fix) (10.28 KB, application/octet-stream)
2014-04-22 14:01 UTC, Vladimir Kvashin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2014-04-21 09:46:22 UTC
Run FileModelTest. Test does not fail, but I see OutOfMemoryError in console:

INFO: Direct buffer memory
java.lang.OutOfMemoryError: Direct buffer memory
	at java.nio.Bits.reserveMemory(Bits.java:658)
	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)
	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:306)
	at org.netbeans.modules.cnd.repository.storage.data.RepositoryDataOutputStream$OutputStreamEx.write(RepositoryDataOutputStream.java:161)
	at java.io.DataOutputStream.write(DataOutputStream.java:107)
	at org.netbeans.modules.cnd.repository.storage.data.UTF.writeUTF(UTF.java:133)
	at org.netbeans.modules.cnd.repository.storage.data.RepositoryDataOutputStream.writeCharSequenceUTF(RepositoryDataOutputStream.java:78)
	at org.netbeans.modules.cnd.modelimpl.repository.PersistentUtils.writeUTF(PersistentUtils.java:338)
	at org.netbeans.modules.cnd.modelimpl.repository.OffsetableKey.write(OffsetableKey.java:135)
	at org.netbeans.modules.cnd.repository.support.AbstractObjectFactory.writeSelfPersistent(AbstractObjectFactory.java:69)
	at org.netbeans.modules.cnd.modelimpl.repository.KeyObjectFactory.writeKey(KeyObjectFactory.java:73)
	at org.netbeans.modules.cnd.modelimpl.uid.KeyBasedUID.write(KeyBasedUID.java:111)
	at org.netbeans.modules.cnd.repository.support.AbstractObjectFactory.writeSelfPersistent(AbstractObjectFactory.java:69)
	at org.netbeans.modules.cnd.modelimpl.uid.UIDObjectFactory.writeUID(UIDObjectFactory.java:131)
	at org.netbeans.modules.cnd.modelimpl.csm.VariableImpl.write(VariableImpl.java:506)
	at org.netbeans.modules.cnd.modelimpl.csm.ParameterImpl.write(ParameterImpl.java:110)
	at org.netbeans.modules.cnd.modelimpl.repository.PersistentUtils.writeParameter(PersistentUtils.java:239)
	at org.netbeans.modules.cnd.modelimpl.repository.PersistentUtils.writeParameters(PersistentUtils.java:192)
	at org.netbeans.modules.cnd.modelimpl.csm.ParameterListImpl.write(ParameterListImpl.java:140)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionParameterListImpl.write(FunctionParameterListImpl.java:174)
	at org.netbeans.modules.cnd.modelimpl.repository.PersistentUtils.writeParameterList(PersistentUtils.java:154)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionImpl.write(FunctionImpl.java:1027)
	at org.netbeans.modules.cnd.modelimpl.csm.FunctionDDImpl.write(FunctionDDImpl.java:325)
	at org.netbeans.modules.cnd.repository.support.AbstractObjectFactory.writeSelfPersistent(AbstractObjectFactory.java:69)
	at org.netbeans.modules.cnd.modelimpl.csm.core.CsmObjectFactory.write(CsmObjectFactory.java:610)
	at org.netbeans.modules.cnd.repository.AsyncRepositoryWriterImpl$Worker.doWrite(AsyncRepositoryWriterImpl.java:327)
	at org.netbeans.modules.cnd.repository.AsyncRepositoryWriterImpl$Worker.run(AsyncRepositoryWriterImpl.java:295)
	at org.openide.util.RequestProcessor$FixedRateTask.run(RequestProcessor.java:1187)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Comment 1 Vladimir Kvashin 2014-04-21 10:27:22 UTC
It fails on file 

cnd.modelimpl/test/unit/data/org/netbeans/modules/cnd/modelimpl/trace/FileModelTest/10000parameters.c

The file contains function that has 10000 parameters.
When writing a parameter, we also write its scope key.
The scope key writes function signature in the case it's from macro.
The signature length is ~40K, and we write it 10000 times when writing parameter.
Comment 2 Vladimir Kvashin 2014-04-21 20:12:40 UTC
Created attachment 146867 [details]
possible fix
Comment 3 Vladimir Kvashin 2014-04-22 14:01:20 UTC
Created attachment 146883 [details]
The same fix with minor improvements and all tests passed (just in case, to have a safe and easy fix)
Comment 4 Quality Engineering 2014-04-23 02:06:52 UTC
Integrated into 'main-silver', will be available in build *201404230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d5699a617b4f
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixed #243960 - OutOfMemoryError in code model tests
Comment 5 Vladimir Kvashin 2014-04-23 08:10:12 UTC
reviewed with Alexander Simon;
pushed to release80 on enum as change set 17e7a29d1bb0;
awaiting for tests in release80 contest to pass
Comment 6 Vladimir Kvashin 2014-04-23 11:21:35 UTC
fixed in releases (release80 branch):
http://hg.netbeans.org/releases/rev/8087d7ab5b34
Comment 7 Quality Engineering 2014-04-24 02:05:08 UTC
Integrated into 'releases/release80', will be available in build *201404240045* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/8087d7ab5b34
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixed #243960 - OutOfMemoryError in code model tests
(transplanted from d5699a617b4fa7e3247ecc7814d11b61a629ca1c)