microsoft / microsoft/mimalloc

Crashes with deleting memory allocated in dlls

Open
#261 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

Overall, we have been quite happy with mimalloc except on windows with applications that use qt. There we get random crashes. The most consistent pattern is in debug builds when hitting the destructor of a std::string that was created within a Qt dll (eg the QString::toStdString). Such crashes can have various cases such as mismatched runtimes, but I think we don't have that. And disabling mimalloc makes it go away.

We both link in the override dll and include `mimalloc-new-delete.h` as described in https://microsoft.github.io/mimalloc/overrides.html.

It is not clear to me how that would work in general (how it would intercept new/delete calls in the Qt dll), but my knowledge of the inner workings of dlls is very minimal.

Version 1.6.3 and 1.6.1. Building with make. Visual studio 2017 (various revisions including the most recent).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report points to Qt DLLs, mimalloc-new-delete.h, the override documentation, and the std::string destructor path from QString::toStdString. Start by reproducing the debug-build crash with Visual Studio 2017 and compare it with mimalloc disabled, focusing on allocation boundaries between the application and DLLs. Done means a minimal reproduction and a confirmed cause or fix for the crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.