hi, all,

I agree with you to remove offset, today when I run following code in 
jdk7(sorry I forget the detail version), my code is like this:




Pattern pattern = Pattern.compile(regex);

Matcher matcher = pattern.match(content);

while (matcher.find()) {

     String link = matcher.group(1);

     set.add(link);// set is a HashSet type

}




after I running for some time, I found that the 'set' object has memory leak, I 
found though 'link' is a part of 'content', but the value field in link 
variable is same as 'content' value field, difference is that the link offset 
field is not zero.

So that mean the set(HashSet) is not store the 'link', it store the 'content' 
value field, it will cause the memory leak problem, So I am very happy to 
reomve the offset field.




Best Regards

=nazario.wang=

Reply via email to