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 102179 - Limit macro expansion on time and size.
Summary: Limit macro expansion on time and size.
Status: CLOSED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-23 16:02 UTC by Alexander Simon
Modified: 2007-11-29 14:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
possible patch (3.76 KB, patch)
2007-04-26 09:34 UTC, Vladimir Voskresensky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2007-04-23 16:02:11 UTC
Template metaprogramming can result in huge time and size at parse time.
Example from boost:
boost_1_33_1/libs/preprocessor/doc/examples/delay.c 
Preprocessor expansion of this example has huge size and time.
Parser should have reasonable limit in such case.
IDE throw java.lang.OutOfMemoryError on example:
java.lang.OutOfMemoryError: Java heap space
       at java.util.LinkedList.addAll(LinkedList.java:278)
       at java.util.LinkedList.addAll(LinkedList.java:247)
       at
org.netbeans.modules.cnd.apt.impl.support.APTExpandedStream.subsituteParams(APTExpandedStream.java:315)
       at
org.netbeans.modules.cnd.apt.impl.support.APTExpandedStream.createMacroBodyWrapper(APTExpandedStream.java:169)
       at
org.netbeans.modules.cnd.apt.impl.support.APTExpandedStream.pushMacroExpanding(APTExpandedStream.java:110)
       at
org.netbeans.modules.cnd.apt.impl.support.APTExpandedStream.nextToken(APTExpandedStream.java:92)
       at org.netbeans.modules.cnd.apt.utils.APTUtils.toList(APTUtils.java:321) 
...
Comment 1 Vladimir Voskresensky 2007-04-26 09:34:09 UTC
Created attachment 41698 [details]
possible patch
Comment 2 Vladimir Voskresensky 2007-05-10 15:36:49 UTC
fixed in grgich_hills branch:
-- threashold to limit the size of expanded macro parameters boost uses delay.c
test from boost_1_33_1/libs/preprocessor/doc/examples/delay.c to slow down
everything using preprocessor only; gcc consumes 2.5G and fails; we are trying
to prevent such experiments over our preprocessor, especially in IDE, so limit
the expanded macros size

cvs log:
Checking in APTExpandedStream.java;
/shared/data/ccvs/repository/cnd/apt/src/org/netbeans/modules/cnd/apt/support/Attic/APTExpandedStream.java,v
 <--  APTExpandedStream.java
new revision: 1.1.2.2; previous revision: 1.1.2.1
done
Comment 3 Vladimir Voskresensky 2007-05-25 12:57:55 UTC
close as fixed, because is fixed in grgich_hills branch