Skip to content

[CORE] Separate the malloc function for box64 itself and the emulated app#4004

Open
zengdage wants to merge 1 commit into
ptitSeb:mainfrom
zengdage:mallochook
Open

[CORE] Separate the malloc function for box64 itself and the emulated app#4004
zengdage wants to merge 1 commit into
ptitSeb:mainfrom
zengdage:mallochook

Conversation

@zengdage

@zengdage zengdage commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

When debugging WeChat and its embedded Electron application, I encountered several memory access errors. After comparative analysis against native x86-64 execution, I found that certain memory blocks are allocated via the app’s self-implemented malloc on x86-64, whereas under Box64 emulation, these allocations fall back to the libc native malloc. This difference triggers runtime crashes in WeChat and its Electron app.

This patch fully isolates Box64’s internal malloc from the emulated program’s custom malloc implementation when the environment variable BOX64_MALLOC_HACK=2 is set, resolving the above crash issue.

@zengdage zengdage force-pushed the mallochook branch 2 times, most recently from 886469f to d2d4976 Compare July 1, 2026 10:45
@ptitSeb

ptitSeb commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Nope. By doing this, you will break every box32 application. I cannot accept this PR

@zengdage

zengdage commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Nope. By doing this, you will break every box32 application. I cannot accept this PR

My apologies, I haven’t yet figured out why this change breaks box32. Could you help explain this to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants