Switch from GetUTFStringChars to GetStringRegion
Replaced GetUTFStringChars/ReleaseUTFStringChars with a more efficient direct string conversion using GetStringRegion. This eliminates unnecessary memory allocations and copies while decoding String from Java into JNI. Fast path - thread_local buffers that serve as temp string storage while building the tracing event. - Replaced ScopedUtfChars with string_views into these buffers, eliminating strdup calls Slow path - Still uses the GetStringRegion to get the utf16 from Java but simply allocate a new string to hold the ascii converted version instead of splicing string_views over the (already full) TLS buffer Fixed a potential crash where extra args that spill over the default pool sizes are not referenced and can be GC'd before they are emitted. Appended any pending PerfettoPointer objects to a list that's freed after emitting. Test: atest PerfettoTest Bug: 303199244 Flag: android.os.perfetto_sdk_tracing_v2 Change-Id: I34bc3dee062544de8194989e657ff658f76110b2
Loading
Please register or sign in to comment