Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15734
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Closing/Despose of JFrame |
| Date | Thu, 28 Jun 2012 23:31:13 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 31 |
| Message-ID | <slrnjupqa1.u9l.avl@gamma.logic.tuwien.ac.at> (permalink) |
| References | <5752befc-aca1-46f9-81d9-f3992bf756e7@googlegroups.com> <jshpac$3v7$1@dont-email.me> <bd012aeb-0dcf-44e3-bb8c-12dc70c8c473@googlegroups.com> |
| Reply-To | avl@logic.at |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 28 Jun 2012 23:31:13 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="bKsX5T0bATV2wS37QVtI5g"; logging-data="24605"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+buOQdb675CEXygvGmttAD" |
| User-Agent | slrn/pre0.9.9-111 (Linux) |
| Cancel-Lock | sha1:KWV3GW85lYhz4D0xY3reyH+5udg= |
| Xref | csiph.com comp.lang.java.programmer:15734 |
Show key headers only | View raw
Lew <lewbloch@gmail.com> wrote:
> Dying old:
> public class Example
> {
> Collection<Foo> foos = getSomeFoos();
> Bar bar; // the elephant in the room
> public void run()
> {
> for (Foo foo : foos)
> {
> bar = foo.obtainBar();
> // do whatever with 'bar'
> // 'bar' does not fall out of scope
> // The last reference from the loop lasts as
> // long as this instance does, and could
> // tenure the 'Bar' it points to
> }
> }
> }
> [...]
> There are some notable urban
> legends out there, such as the advice to set all references
> to 'null' when finished with them. There are specific times
> to do so, such as when a collection such as a 'Stack' is
> holding hidden references ("packratting", or the Java version
> of a memory leak). [...]
...or right after the loop in above "dying old"-Example, if for
whatever reason there really was some need to have "bar" as a
field, instead of as a local var within the loop.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Closing/Despose of JFrame Jesper Johnsen <jsjohnsen.dk@gmail.com> - 2012-06-28 06:38 -0700
Re: Closing/Despose of JFrame markspace <-@.> - 2012-06-28 07:22 -0700
Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-28 09:47 -0700
Re: Closing/Despose of JFrame Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-28 23:31 +0000
Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-28 17:42 -0700
Re: Closing/Despose of JFrame Gene Wirchenko <genew@ocis.net> - 2012-06-28 19:55 -0700
Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-29 10:19 -0700
Re: Closing/Despose of JFrame Gene Wirchenko <genew@ocis.net> - 2012-06-29 13:24 -0700
Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-29 13:36 -0700
Re: Closing/Despose of JFrame Roedy Green <see_website@mindprod.com.invalid> - 2012-06-29 05:31 -0700
Re: Closing/Despose of JFrame Lew <lewbloch@gmail.com> - 2012-06-28 12:46 -0700
Re: Closing/Despose of JFrame "John B. Matthews" <nospam@nospam.invalid> - 2012-06-28 22:32 -0400
csiph-web