This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch for Review: JvGetStringUTF and JvTempCString
Mohan Embar writes:
> Hi People,
>
> >I think that stack size in a thread might be limited to one megabyte.
> >We probably wouldn't want any stack-allocated string to be a
> >significant fraction of that, so perhaps the limit should be 1k or
> >10k. This might be significant in a complex parser, for instance.
>
> 1. So are we okay with the approach where:
>
> - the helper class allocates 256 bytes on the stack and tries to cram
> the string in there if it fits
Up to 256 bytes; don't allocate memory that you won't use.
> - if it doesn't fit, allocate some memory using either _Jv_Malloc() or
> _Jv_AllocBytes()
That seems like a sensible approach. It won't greatly complicate the
code and it optimizes for the common case.
> 2. Shall I try to run some crude timings so see whether _Jv_Malloc() or
> _Jv_AllocBytes() is a faster?
It might be interesting, but it isn't very important.
Andrew.