Closed Bug 618049 Opened 15 years ago Closed 7 years ago

xpc_qsACString copies its string twice, should only do it once

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- -

People

(Reporter: bent.mozilla, Assigned: bent.mozilla)

References

Details

xpc_qsACString calls JS_EncodeString, which manages a JS engine malloc'd buffer. Then we copy that buffer to nsCString before freeing the JS engine's buffer. We could just call JS_EncodeStringToBuffer and only do it once.
Not quite, because that would be allocated with whatever allocator js uses, while strings will free with the nsMemory allocator, which may not be the same. :(
No, you just preallocate the nsCString buffer (via SetCapacity) then JS_EncodeStringToBuffer writes to that.
(i.e. don't Adopt())
Oh, I see. Yeah, that sounds good.
Not blocking on this. I'd approve a safe patch, but won't hold the release for this.
blocking2.0: betaN+ → -
But Ben, you get to own this either way :)
Assignee: nobody → bent.mozilla
Blocks: 612642
I assume this is still valid.
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
Quickstubs are gone, and webidl bindings don't have this problem.
Depends on: 1019191
Resolution: INACTIVE → FIXED
You need to log in before you can comment on or make changes to this bug.