Closed Bug 392008 Opened 17 years ago Closed 4 years ago

trace-malloc handling of realloc and free is not threadsafe

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dbaron, Unassigned)

References

Details

trace-malloc's handling of realloc is not threadsafe, on either Linux or Windows (although it's different on both).

We need to remove the address from the allocations table before calling the system realloc because it could potentially be reallocated on another thread before we get a chance to remove it from the allocations table afterwards.
Blocks: 392009
Stealing. I would prefer to un-duplicate, then fix once.

/be
Assignee: dbaron → brendan
No longer blocks: 392009
Depends on: 392009
Note that on Mac OS X, we'd need to change the way we hook the allocation functions to fix this.   Instead of using the hooks, we should override the vtable pointers in the result of malloc_default_zone(), as the #if 0-ed code in nsCycleCollector does, assuming that doing that works.
This has actually always been a problem for free on Windows as well, and is now a problem for free on Linux too.
Summary: trace-malloc handling of realloc is not threadsafe → trace-malloc handling of realloc and free is not threadsafe
Giving back this one too -- no time for trace-malloc, sigh.

/be
Assignee: brendan → general

trace-malloc was removed in bug 1014341.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.