This content has been marked as final. Show 3 replies
You're assuming that it's regex that's causing the OOM error. Profile your code and see if this is true.
Well if the garbage collector doesn't get rid of them, something is still referencing them. However, why do you think it is the regex's causes you to run out of memory? I would do some profiling to determine the true cause.
EDIT: wow, that was slow.
memory error occurs. I have also tried to solve thisRead: Idioms that are wrong
problem by assigning null value to the regex objects
"Explicit nulling should be saved for cases where your program is subverting normal scoping rules"
For most applications, explicit nulling, object pooling, and explicit garbage collection will harm the throughput of your application, not improve it -- not to mention the intrusiveness of these techniques on your program design. In certain situations, it may be acceptable to trade throughput for predictability -- such as real-time or embedded applications. But for many Java applications, including most server-side applications, you probably would rather have the throughput.