How do i explicitly clear the byte[]
问题 I am creating new byte arrays which are not being collected by GC and are living in memory and increasing the private bytes. The code below gets executed every 10 seconds. How do I explicitly clear the variable after I am done with it? byte[] outputMessage = new byte[10000]; //Do some work here 回答1: How do you know they are not being collected? The code you provide is fine, and it should become eligible for collection if you don't have any dangling references to it. Explicitly, you can clear