Your code looks fine to me - as long as k isn't extraordinary large. Even the "buff = null;" is not required. Does exactly that code pose a problem? I'd rather suspect a problem in that "//do some stuff with buff[]" area.
-- http://www.deepdroid.com On Apr 17, 10:33 pm, jj <[email protected]> wrote: > Hi > > I know this is more a java question, but I have been in many java > forums, and the theory seems to contradict the real thing... > > I have a very simple function that creates memory, do something with > it, and returns: > > static void test(int k) > { > byte [] buff = new byte[k]; > > //do some stuff with buff[] > > buff=null; > > } > > After a few calls to this function, it runs out memory > In C++ I would use delete at the end, and here in java I've been told > that GC takes care of it, but it seems that it does not > Am I doing something wrong? how can I free this temp memory after I > have used it? > > many thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

