Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Avoid creating a stacktrace prior to JDK 1.7 Date: Sun, 02 Oct 2011 20:26:44 +0200 Organization: albasani.net Lines: 26 Message-ID: References: <4424828.699.1317485416810.JavaMail.geo-discussion-forums@prng5> <1058576.2212.1317496868028.JavaMail.geo-discussion-forums@prfh23> <16954967.979.1317524784002.JavaMail.geo-discussion-forums@prng5> <32945439.611.1317569831219.JavaMail.geo-discussion-forums@prni6> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net fq6qdW/YS/+C/71OtCIzT3jTNqPXVW6ODuaYZFMJyez6ezW9CYOKAfLOh8QoZbvstwVIlNSu3FlugzP7q5duow== NNTP-Posting-Date: Sun, 2 Oct 2011 18:26:48 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="nhROZOrQtk/FzepTj4Xi0+ISlq38lrhYxG2sYe16Mbj1BSRZF4kBokLMUdLwppP6xu92ODRLt2Y2eQcdTTlbDdEpm8gKf06knmew7CzRw7SlmQCMRKsu+Dl6dUIV4BUi"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 SeaMonkey/2.4.1 In-Reply-To: <32945439.611.1317569831219.JavaMail.geo-discussion-forums@prni6> Cancel-Lock: sha1:fIRM/Zz58QPaeoBWItmSp11L0Qg= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8485 Lew schrieb: > There's a difference between "no information" and "information that > there is no information". The latter tells you something, at least. My original question was: How can I force an exception to not record some stack frame list at all. One proposed solution so far was pre-allocating exceptions from a call site with a few stack frames. Eventually also calling the following method on the pre-allocated exception: setStackTrace(new StackTraceElement[0]); So as to even free the stack trace that was allocate from the call site with only a few stack frames. The above method is available since JDK 1.4. What about calling setStackTrace() just after the new and before the throw. This would only give a space advantage but not a time advantage. Any other suggestions? Bye