Patch: MAXPATHLEN usage - PR21821

Andrew Haley
Thu Jun 2 17:19:00 GMT 2005

Bryce McKinlay writes:

 > >Per> For CNI code it would be even better to use a stack-allocated
 > >Per> "RawStringBuilder" struct:
 > >
 > >When compiling from source, gcj uses gnu.gcj.runtime.StringBuffer to
 > >implement String concatenation; we could change it to stack allocate
 > >this too.
 > A potential argument against this is that was raised recently is that 
 > stack-allocation creates more work for the GC and increases the chance 
 > of "uninitialized stack holes" where dangling pointers can hide. Without 
 > precise stack scanning, I'm not convinced that the gains would be worth 
 > it compared to potential heap bloat caused by false pointers?

That's true.  However, it would be possible to solve this problem
entirely by zeroing stack-allocated buffers.  From what I've seen of
the overhead of conservatively scanning the stacks, this would
probably be worthwhile.


More information about the Java-patches mailing list