[java-dev] memory running wild
Siska Ádám
sadam at startvox.hu
Tue Jul 17 08:40:29 MDT 2007
- Previous message: [java-dev] Re: memory running wild
- Next message: [java-dev] Re: memory running wild
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello, Check these two links: http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#18470 http://www.yoda.arachsys.com/java/passing.html In Java, a variable is something like pointers in C (except for primitive types). This means, that you'll never get "deep copies" of objects passed through the argument list of a function (except for primitive types). If you have a primitive type (int, float, boolean etc), you get it passed "by value", and if you have any other object, you get the variable (that is, the pointer to the object) passed "by value", not a copy of the object itself. (If you have a String, or any other immutable object, you'll get a variable that points to the same location in the internal string table of Java than the original string variable). Hope this helps, Adam ________________ Siska Ádám +36 (70) 207-63-85 http://apocalypse.rulez.org/~sadam jbmaxwell wrote: > I seem to have created a memory leak of some kind. > > I have an object, say "Link", that makes associations between two instances of another type of objects, say "Thing". Basically, I'm testing for similarity between Things, and using Links to record the similarities found. > > The Link has a constructor which takes two Things, and some analysis data indicating the ways in which they are similar. What I'm curious about is whether such a constructor would make deep copies of the two Thing objects, or just store references? The way my memory usage is spinning out of control, I'm guessing that actual copies are being made. Is there any way to check this? Is there any way to avoid this? > > Thanks for any thoughts. > > J. > _______________________________________________ > java-dev mailing list > java-dev at cycling74.com > http://www.cycling74.com/mailman/listinfo/java-dev > >
- Previous message: [java-dev] Re: memory running wild
- Next message: [java-dev] Re: memory running wild
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
