Re: String.valueOf() Memory Leak inside of thread.




Thomas Hawtin wrote:
BLlewellyn@xxxxxxxxx wrote:

This is causing a memory leak. If I change the line to read "String
str = "String.valueOf("1"); there is no problem. Also, if I do
something like: String str = "Hello world!"; there is also no problem.

If I use String.valueOf(1); inside the loop but outside of the thread,
there is no problem. Can anyone see why garbage collection is not
occurring inside the thread?

Are you sure you aren't just causing vast numbers of threads to be
running at once? Does shoving in a thread.join() fix it for you?

Tom Hawtin

Tom:

I have tried adding a thread.join() immediately after the
thread.start() method is called. The result is the same - according to
the NetBeans Profiler, none of the strings are being reclaimed. Any
more thoughts?

Thanks!

--Brad

.



Relevant Pages

  • Re: Truss rod basic Q
    ... I have eyeballed the relief when I fret the low e string at the first ... tune up right after you make the adjustment (to bring it back up to the ... The truss rod is typically 8 or 10/32 thread, ... nut may save it from one day refusing to move smoothly, causing you to ...
    (alt.guitar.beginner)
  • Re: Strange Error
    ... The line that is causing me headaches is: ... My guess would be that your AuthorCode is longer than 256--I suggest you ... Visual Studio, but gives that error when compiled to an exe and run from ... wcscpy will just trample the end of the destination string over ...
    (microsoft.public.dotnet.languages.vc)
  • Re: nullpointer exception
    ... how do you find out what variable is causing a NullPointerException please.. ... the null reference must be one of those mentioned ... String s = foo.toString+ bar.toString ...
    (comp.lang.java.help)
  • Re: Style of coding
    ... Thomas Hawtin wrote: ... public void setName{ ... private final String name; ...
    (comp.lang.java.programmer)
  • Re: Run Time error 2448, You cannot assign a value to this object !!
    ... The line causing the problem is: ... Forms!frmMainMenu.frmCustomers_edit!contactID = contactID 'value ... >> Dim stLinkCriteria As String ...
    (microsoft.public.access.forms)