Comments (16)
Ah, that is no good -- I just ran the test on Win 10 (with VS2017) and no problems. Could you build the debug configuration and see if there is a clue?
from mimalloc.
debug configuration if fine.
mimalloc: process init: 0x7fffffde000
mimalloc: debug level : 1
mimalloc: option 'secure': 0
mimalloc: option 'page_reset': 0
heap stats: peak total freed unit count
normal 1: 16 b 16 b 16 b 8 b 2 ok
normal 2: 16 b 16 b 16 b 16 b 1 ok
normal 4: 32 b 64 b 64 b 32 b 2 ok
normal 9: 80 b 80 b 80 b 80 b 1 ok
heap stats: peak total freed unit count
normal: 144 b 176 b 176 b 1 b ok
huge: 0 b 0 b 0 b 1 b ok
total: 144 b 176 b 176 b 1 b ok
malloc requested: 176 b
committed: 12.0 kb 12.0 kb 12.0 kb 1 b ok
reserved: 0 b 0 b 0 b 1 b ok
reset: 0 0 0
segments: 0 0 0
-abandoned: 0 0 0
pages: 3 3 3
-abandoned: 0 0 0
-extended: 3
mmaps: 0
mmap fast: 0
mmap slow: 0
threads: 0
searches: 0.0 avg
elapsed: 0.000 s
process: user: 0.000 s, system: 0.000 s, faults: 739, reclaims: 0, rss: 2.9 m
b
mimalloc: option 'show_stats': 0
heap stats: peak total freed unit count
normal 1: 16 b 16 b 24 b 8 b 2 ok
normal 2: 16 b 16 b 16 b 16 b 1 ok
normal 4: 32 b 64 b 64 b 32 b 2 ok
normal 9: 80 b 80 b 80 b 80 b 1 ok
normal 28: 2.0 kb 2.0 kb 0 b 2.0 kb 1 not all free
d!
heap stats: peak total freed unit count
normal: 2.1 kb 2.2 kb 184 b 1 b not all free
d!
huge: 0 b 0 b 0 b 1 b ok
total: 2.1 kb 2.2 kb 184 b 1 b not all free
d!
malloc requested: 2.2 kb
committed: 12.0 kb 16.0 kb 24.0 kb 1 b ok
reserved: 0 b 0 b 0 b 1 b ok
reset: 0 0 0
segments: 0 0 0
-abandoned: 0 0 0
pages: 3 4 6
-abandoned: 0 0 0
-extended: 4
mmaps: 0
mmap fast: 0
mmap slow: 0
threads: 0
searches: 0.0 avg
elapsed: 0.014 s
process: user: 0.016 s, system: 0.000 s, faults: 746, reclaims: 0, rss: 2.9 m
b
mimalloc: process done: 0x7fffffde000
G:\GitProjects\mimalloc\ide\vs2017\..\..\out\msvc-x64\Debug\mimalloc-override-te
st.exe (process 20756) exited with code 0.
Press any key to close this window . . .
from mimalloc.
ah I see. I don't have a Win 7 system at hand to reproduce the problem but I will look into it. Can you try building the release version of mimalloc with just debug info and see if the problem still happens? (it might be related to differences in the ucrtbase.dll in the debug and release versions)
from mimalloc.
I have try it, still crashed. It's seams the release version not get patched.If I modify the code free(s)
to mi_free(s)
, release version will fine.
main-override.cpp
int main() {
mi_stats_reset();
atexit(free_p);
void* p1 = malloc(78);
void* p2 = malloc(24);
free(p1);
p1 = malloc(8);
char* s = mi_strdup("hello\n");
free(p2);
p2 = malloc(16);
p1 = realloc(p1, 32);
free(p1);
free(p2);
mi_free(s);//free(s);
mi_collect(true);
mi_stats_print(NULL);
return 0;
}
from mimalloc.
Hmm, can you verify if the mi_stats_print
output shows that the other malloc
and free
calls were actually redirected at all to mimalloc? (the output should match the debug one except for the strdup).
What if you leave the free(s)
but use strdup
instead of mi_strdup
?
from mimalloc.
The output not match the debug one. It's seams the release version patch failed.
use strdup
and free
output:
heap stats: peak total freed unit count
elapsed: 0.000 s
process: user: 0.000 s, system: 0.000 s, faults: 613, reclaims: 0, rss: 2.4 m
b
from mimalloc.
Ah, sorry, you also need to define #define MI_STAT 2
in the mimalloc-types.h
header file or the release version won't keep statistics. Can you try that?
from mimalloc.
The dev branch seems crashing on Windows even in debug buiild. Master branch is fine. Looks like override failed to take effect there.
from mimalloc.
Thanks! I am on it. Currently redoing the low-level OS allocation code on the dev
branch and looking into it.
from mimalloc.
Ah, it turns out that adding virtualalloc2 for aligned allocations on windows caused both msvcrt and ucrtbase to be loaded at the same time which both declare entry points for allocation functions -- I now ensure to only patch the ucrtbase which seems to fix this. Commit dev 9390642 available on the latest dev
branch should fix this.
from mimalloc.
@sniper00: I hope that also fixes the issue on Win 7 -- let me know
from mimalloc.
Unfortunately still crashed.
G:\GitProjects\mimalloc>git log --stat
commit 93906428798ff6f4e1b71bf2afc087f6920dddf6 (HEAD -> dev)
from mimalloc.
Ah, i pushed more possible fixes recently -- can you try the latest dev branch? Fingers crossed
from mimalloc.
and I still meet the crash in the latest dev branch. As in the beginning.
use strdup
and free
is fine, output:
heap stats: peak total freed unit count
normal 1: 8 b 8 b 8 b 8 b 1 ok
heap stats: peak total freed unit count
normal: 8 b 8 b 8 b 1 b ok
huge: 0 b 0 b 0 b 1 b ok
total: 8 b 8 b 8 b 1 b ok
malloc requested: 8 b
reserved: 0 b 0 b 0 b 1 b ok
committed: 0 b 0 b 0 b 1 b ok
reset: 0 0 0
touched: 4.0 kb 4.0 kb 4.0 kb 1 b ok
segments: 0 0 0
-abandoned: 0 0 0
pages: 1 1 1
-abandoned: 0 0 0
-extended: 1
mmaps: 0
mmap fast: 0
mmap slow: 0
commits: 0
threads: 0
searches: 0.0 avg
elapsed: 0.000 s
process: user: 0.000 s, system: 0.000 s, faults: 870, reclaims: 0, rss: 3.4 m
b
G:\GitProjects\mimalloc\ide\vs2017\..\..\out\msvc-x64\Release\mimalloc-override-
test.exe (process 19432) exited with code 0.
Press any key to close this window . . .
from mimalloc.
I pushed more potential fixes on the latest dev branch. (I really need to get a Win7 machine to test properly... but for now thank you for testing!).
If it still crashes, please run with MIMALLOC_VERBOSE=2
(which is enabled in the Visual Studio project already) and send the trace messages which should show all the DLL patched entry points. Thanks!
from mimalloc.
Release version is ok ,and the output same as the Debug one. Well done.
from mimalloc.
Related Issues (20)
- 2.1.4 Failure build for ppc64le error: โ__builtin_thread_pointerโ is not supported on this target HOT 12
- 2.1.4 and error mingw/msys2 HOT 4
- 2.1.4: build fail on centos7 HOT 7
- CMake install with namespace and add corresponding alias targets HOT 2
- Rss memory usage increase in version 2.1.4 HOT 2
- Add dllhook mode HOT 1
- oversize allocation in mi_heap_malloc_zero_aligned_at HOT 6
- Concurrency bugs that cause hanging HOT 2
- Intermittent VirtualAlloc failure while the pagefile is growing HOT 1
- Tests fail on armhf and armv7 on Alpine Linux (musl libc) since mimalloc 2.1.4 & 1.8.4 HOT 4
- [suggestion] add a comment at the declaration of `mi_arena_t` for easier custom modify HOT 1
- Can't compile v2.1.6 tag on Ubuntu 22.04.LTS HOT 3
- malloc_good_size in overrides HOT 13
- Is it ok that `ld-linux-x86-64.so.2` `Scrt1.o` `crti.o` and `crtbeginS.o` is located before `mimalloc.o` in the linker commandline when static override malloc? HOT 1
- Inconsistent output naming of `mimalloc.dll` HOT 3
- 2.1.4: crash in mi_segment_try_purge during mi_process_done HOT 2
- Misplaced count size HOT 1
- mimalloc.o not available in vcpkg
- mimalloc-redirect for aarch64? HOT 1
- Cannot build mimalloc-2.1.7 with mingw32-8.5.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mimalloc.