snmalloc icon indicating copy to clipboard operation
snmalloc copied to clipboard

investigate the problem on MinGW

Open SchrodingerZhu opened this issue 5 years ago • 35 comments

In debug mode, I see some other errors:

  • [x] ctz failed to return the correct result.
  • [x] mingw gcc has no -rdynamic
  • [ ] func-first-operation failed, showing ERROR: allocator in use

SchrodingerZhu avatar Jun 23 '20 08:06 SchrodingerZhu

Currently, I cannot fix the problem on my own. I have traced into the deallocation path. During the process, snmalloc::current_alloc_pool()->list is changed. After that, iterate() returns the list head whose in_use flag is reset.

SchrodingerZhu avatar Jun 23 '20 09:06 SchrodingerZhu

Do you have a debug stack trace of when the flag is updated? The easiest way to debug this kind of crash is with time travel debugging with "WinDBG Preview", when you get the in_use flag that fails, add a break point on that address and run backwards looking at where it is changed.

If you can post the stack traces, I can probably work it out what might be happening.

mjp41 avatar Jun 23 '20 09:06 mjp41

stack traces of acquire (the only operation that changes list):

C:\msys64\home\JimmyZhu\snmalloc\cmake-build-debug\func-first_operation-1.exe
.Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Thread id: 5 has terminated
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!RtlActivateActivationContextUnsafeFast 0x00007ffde3248c93
	ntdll!LdrShutdownThread 0x00007ffde3249ab6
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510b
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Thread id: 8 has terminated
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	SleepEx 0x00007ffde0abb9be
	pthread_create_wrapper 0x000000006494506d
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Thread id: 10 has terminated
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Thread id: 11 has terminated
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Thread id: 12 has terminated
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Thread id: 13 has terminated
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!LdrShutdownThread 0x00007ffde3249b60
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	SleepEx 0x00007ffde0abb9be
	pthread_create_wrapper 0x000000006494506d
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2cStack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	KERNELBASE!FlsGetValue 0x00007ffde0a9551bLazy test!
ERROR: allocator in use.
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	Invalid thread id: 17

Process finished with exit code 3

SchrodingerZhu avatar Jun 23 '20 10:06 SchrodingerZhu

more detailed version:

C:\msys64\home\JimmyZhu\snmalloc\cmake-build-debug\func-first_operation-1.exe
.Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) NULL
Stack: 
	Thread id: 5 has terminated
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffe4000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!LdrShutdownThread 0x00007ffde3249b3b
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510b
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffe8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!LdrShutdownThread 0x00007ffde32499f2
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510bBreakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffec000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!LdrUnloadAlternateResourceModuleEx 0x00007ffde321b0ea
	ntdll!LdrShutdownThread 0x00007ffde32499ed
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510b
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc0000
Stack: 
	Thread id: 9 has terminated
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc4000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!RtlActivateActivationContextUnsafeFast 0x00007ffde3248c93
	ntdll!LdrShutdownThread 0x00007ffde3249ab6
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510b
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!LdrUnloadAlternateResourceModuleEx 0x00007ffde321b0ea
	ntdll!LdrShutdownThread 0x00007ffde32499ed
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510b
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffcc000
Stack: 
	Invalid thread id: 12
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffd0000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffd0000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	VirtualAlloc 0x00007ffde0acf2b8
	snmalloc::PALWindows::notify_using<(snmalloc::ZeroMem)0> pal_windows.h:137
	std::thread::thread<void (&)(void*, unsigned long long), void*&, unsigned long long&, void> thread:130
	f first_operation.cc:159
	main first_operation.cc:189
	__tmainCRTStartup 0x00000000004013b4
	mainCRTStartup 0x000000000040150b
Stack: 
	Thread id: 13 has terminated
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffd8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	ntdll!LdrUnloadAlternateResourceModuleEx 0x00007ffde321b0ea
	ntdll!LdrShutdownThread 0x00007ffde32499ed
	ntdll!RtlExitUserThread 0x00007ffde326435e
	msvcrt!_endthreadex 0x00007ffde2f3dea7
	pthread_create_wrapper 0x000000006494510b
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2cBreakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffdc000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	SleepEx 0x00007ffde0abb9be
	pthread_create_wrapper 0x000000006494506d
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ff80000
Stack: 
	Thread id: 16 has terminated
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ff84000
Stack: 
	Thread id: 17 has terminated
Breakpoint reached: pool.h:75
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ff88000
Lazy test!
ERROR: allocator in use.
Stack: 
	Invalid thread id: 1

Process finished with exit code 3

SchrodingerZhu avatar Jun 23 '20 10:06 SchrodingerZhu

But release changes the in_use flag as well. So that would be useful to see.

Also, are the stack traces being printed interleaved? The following looks strange. VirtualAlloc should not be calling into snmalloc.

        snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	VirtualAlloc 0x00007ffde0acf2b8
	snmalloc::PALWindows::notify_using<(snmalloc::ZeroMem)0> pal_windows.h:137

mjp41 avatar Jun 23 '20 10:06 mjp41

already checked release at the second log. seems it is only called once Breakpoint reached: pool.h:75.

let me check whether the output is not interrupting each other.

SchrodingerZhu avatar Jun 23 '20 12:06 SchrodingerZhu

Here is the result generated by suspending the program on each hit:

C:\msys64\home\JimmyZhu\snmalloc\cmake-build-debug\func-first_operation-1.exe
.Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) NULL
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::ThreadAllocCommon::get threadalloc.h:202
	get_test first_operation.cc:25
	std::__invoke_impl<void, void (*)()> invoke.h:60
	std::__invoke<void (*)()> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)()> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffe4000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_first_alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1144
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_rare<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1133
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_next_free_list<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1115
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_inner<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1073
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1046
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc_not_small<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:193
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:183
	alloc1 first_operation.cc:48
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffe8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_first_alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1144
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_rare<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1133
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_next_free_list<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1115
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_inner<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1073
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1046
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc_not_small<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:193
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:183
	alloc2 first_operation.cc:55
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffec000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_first_alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1144
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_rare<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1133
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_next_free_list<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1115
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_inner<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1073
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:1046
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc_not_small<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:193
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc<(snmalloc::ZeroMem)0, (snmalloc::AllowReserve)1> alloc.h:183
	alloc3 first_operation.cc:62
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc0000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::ThreadAllocCommon::get threadalloc.h:202
	alloc4 first_operation.cc:68
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc4000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_first_alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1144
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_rare<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1133
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_next_free_list<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1115
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_inner<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1073
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1046
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc_not_small<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:193
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:183
	calloc1 first_operation.cc:89
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_first_alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1144
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_rare<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1133
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_next_free_list<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1115
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_inner<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1073
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1046
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc_not_small<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:193
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:183
	calloc2 first_operation.cc:98
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffc8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	f first_operation.cc:151
	main first_operation.cc:189
	__tmainCRTStartup 0x00000000004013b4
	mainCRTStartup 0x000000000040150b
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffd0000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_first_alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1144
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_rare<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1133
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_next_free_list<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1115
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc_inner<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1073
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::small_alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:1046
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc_not_small<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:193
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::alloc<(snmalloc::ZeroMem)1, (snmalloc::AllowReserve)1> alloc.h:183
	calloc3 first_operation.cc:106
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffd4000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::ThreadAllocCommon::get threadalloc.h:202
	calloc4 first_operation.cc:113
	std::__invoke_impl<void, void (*)(unsigned long long), unsigned long long> invoke.h:60
	std::__invoke<void (*)(unsigned long long), unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::_M_invoke<0ull, 1ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long long), unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffd8000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::remote_dealloc_slow alloc.h:1482
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::remote_dealloc alloc.h:1469
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::dealloc alloc.h:298
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::dealloc_sized_slow alloc.h:308
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::dealloc alloc.h:301
	dealloc2 first_operation.cc:126
	std::__invoke_impl<void, void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:60
	std::__invoke<void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::_M_invoke<0ull, 1ull, 2ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ffdc000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::remote_dealloc_slow alloc.h:1482
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::remote_dealloc alloc.h:1469
	snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>::dealloc alloc.h:352
	dealloc1 first_operation.cc:121
	std::__invoke_impl<void, void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:60
	std::__invoke<void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::_M_invoke<0ull, 1ull, 2ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ff80000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::ThreadAllocCommon::get threadalloc.h:202
	dealloc3 first_operation.cc:131
	std::__invoke_impl<void, void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:60
	std::__invoke<void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::_M_invoke<0ull, 1ull, 2ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:48
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ff84000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::acquire<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>&> pool.h:50
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::acquire globalalloc.h:34
	snmalloc::init_thread_allocator(snmalloc::function_ref<void* (void*)>) threadalloc.h:287
	snmalloc::ThreadAllocCommon::get threadalloc.h:202
	dealloc4 first_operation.cc:136
	std::__invoke_impl<void, void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:60
	std::__invoke<void (*)(void*, unsigned long long), void*, unsigned long long> invoke.h:95
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::_M_invoke<0ull, 1ull, 2ull> thread:244
	std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> >::operator() thread:251
	std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(void*, unsigned long long), void*, unsigned long long> > >::_M_run thread:195
	<unknown> 0x000000006fd42441
	pthread_create_wrapper 0x0000000064945092
	msvcrt!_beginthreadex 0x00007ffde2f3de54
	msvcrt!_endthreadex 0x00007ffde2f3df2c
	KERNEL32!BaseThreadInitThunk 0x00007ffde2118f4e
	ntdll!RtlUserThreadStart 0x00007ffde32642db
	<unknown> 0x0000000000000000
Breakpoint reached: pool.h:75
list = (snmalloc::Allocator<snmalloc::needs_initialisation, snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20, unsigned char, 0> > >, true> *) 0x17ff88000
Stack: 
	snmalloc::Pool<snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true>, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows> >::release pool.h:80
	snmalloc::AllocPool<snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::Allocator<&snmalloc::needs_initialisation, &snmalloc::init_thread_allocator, snmalloc::MemoryProviderStateMixin<snmalloc::PALWindows>, snmalloc::DefaultChunkMap<snmalloc::GlobalPagemapTemplate<snmalloc::Pagemap<20ull, unsigned char, (unsigned char)0> > >, true> >::release globalalloc.h:39
	f first_operation.cc:174
	main first_operation.cc:189
	__tmainCRTStartup 0x00000000004013b4
	mainCRTStartup 0x000000000040150b
Lazy test!
ERROR: allocator in use.

Process finished with exit code 3

SchrodingerZhu avatar Jun 23 '20 12:06 SchrodingerZhu

It is not calling inner_release in the destructor of

static thread_local OnDestruct<ThreadAllocCommon::inner_release> tidier;

This works on other implementations of the CRT. I guess it could be a mingw bug? The only call to release is a direct call.

Has this been failing long? Or has it just started? Can you bisect when it started?

mjp41 avatar Jun 23 '20 12:06 mjp41

test failed since 74657d9, which is really bad because it is the point to add the test.

and debug failed to compile since -rdynamic is added

SchrodingerZhu avatar Jun 23 '20 14:06 SchrodingerZhu

so, according to the current result, it seems that MinGW GCC support is never correct since added? Sadly, the bug appears on GCC9, GCC10 and clang-10.

SchrodingerZhu avatar Jun 23 '20 14:06 SchrodingerZhu

I get no output with :

#include <iostream>
#include <mutex>
#include <thread>
#include <vector>
static std::mutex lock;

struct DtorTest {
  ~DtorTest(){
	lock.lock();
        std::cout << "dtor called " << std::this_thread::get_id() << std::endl;
        lock.unlock();	
  }
};

void _register() {
	static thread_local DtorTest test {};
}

const size_t TEST = 12;
int main() {
	std::vector<std::thread> threads;
	for (size_t i = 0; i < TEST; ++i) {
		threads.emplace_back(_register);
	}	
	for (auto& i : threads) {
		i.join();
	}
}

SchrodingerZhu avatar Jun 23 '20 14:06 SchrodingerZhu

I don't really want to support MinGW as I don't see much demand, and this makes me even less keen. It will lead to memory leaks on MinGW.

Your mini examples works on my machine in WSL with g++/clang++ and Visual studio cl.exe.

mjp41 avatar Jun 23 '20 14:06 mjp41

Sadly, the bug appears on GCC9, GCC10 and clang-10.

I assume this is with MinGW?

mjp41 avatar Jun 23 '20 14:06 mjp41

Sadly, the bug appears on GCC9, GCC10 and clang-10.

I assume this is with MinGW?

yes. MinGW's compilers.

SchrodingerZhu avatar Jun 23 '20 14:06 SchrodingerZhu

I am reporting this bug. MinGW seems to have tons of troubles with thread_local things. https://github.com/msys2/MINGW-packages/issues/2519#issuecomment-304155278 It may be a good idea to drop its support if no further progress is made. I will consider add warnings to my rust crates. It is sad that linking w/ MinGW is already causing me troubles before. It was a good choice to use mingw with rust because some good IDEs was having poor support w/ the debuggers from MSVC. but everything is improved since then.

SchrodingerZhu avatar Jun 23 '20 14:06 SchrodingerZhu

Three year old issues. I am not particularly hopeful it will be fixed.

mjp41 avatar Jun 23 '20 15:06 mjp41

@SchrodingerZhu I believe it's one of many MinGW libgcc issues. Your code example works better with compiler-rt + libunwind:

$ clang++ mingw.cpp -rtlib=compiler-rt -lunwind && ./a
dtor called 2
dtor called 5
dtor called 4
dtor called 8
dtor called 10
dtor called 6
dtor called 12
dtor called 3
dtor called 11
dtor called 7
dtor called 13
dtor called 9
Windows error: Parameter is incorrect.

mati865 avatar Jun 23 '20 16:06 mati865

Hello, I am the guy who reported the issue in mingw. I had some luck with the following patch ( to winpthread ), but unfortunately at the moment i have no time to follow up.

diff --git a/src/thread.c b/src/thread.c
index 7d18901..2a4c9b8 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -839,7 +839,7 @@ _pthread_cleanup_dest (pthread_t t)
 		int flag = 0;
 
 		_spin_lite_lock (&tv->spin_keys);
-		for (i = 0; i < tv->keymax; i++)
+		for (i = tv->keymax; i-- > 0; )
 		{
 			void *val = tv->keyval[i];
 

sbabbi avatar Jun 23 '20 16:06 sbabbi

@mati865 and @sbabbi thanks. I think our issue is slightly different, it __cxa_thread_atexit does not appear to be doing the right thing with regard to the TLS implementation. The things registered with it aren't even called. Thanks both for the suggestions.

mjp41 avatar Jun 24 '20 08:06 mjp41

I got some time tracing the TLS destruction procedure. It seems that those tls_callback and __mingw_cxa_thread_atexit functions are invoked correctly; but there is one thing strange that tls_dtors appear to be optimized out in the distributed binary from MSYS2. Considering the later behavior of the callback functions, I think this optimized-out global variable may lead to some problems here. Indeed, when I step into run_dtor_list. I see GDB jump to some strange address (0x00000000000) and leave a SIGFAULT to me. However, since I do not have a powerful windows PC, I do not have the conditions to test whether it is the true problem to blame.


FYI, tls_dtors is the list of registered dtors. I can see the dtors are pushed to that list, but when the callback executes, the list is broken somehow. It is optimized out in the binary distribution and the call back functions need to use its address.

SchrodingerZhu avatar Jun 24 '20 08:06 SchrodingerZhu

I'm working on fixing MSYS2 libc++. In the meantime you can try using this MinGW toolchain: https://github.com/mstorsjo/llvm-mingw It doesn't use winpthreads at all so it could help here, I can test it if you provide me instructions.

mati865 avatar Jun 24 '20 09:06 mati865

@mjp41 I think @mati865 shows that with compiler-rt the dtors are called correctly but after that an unknown error is thrown. This reproduces on my PC with MinGW, too.


@mati865 I have tried the mcfgthread library by @lhmouse. I think it is also not working here (but maybe I was not using it correctly)? As what I have said in https://github.com/microsoft/snmalloc/pull/217#issuecomment-648686598, the problem seems to occur at the crt library (https://github.com/mirror/mingw-w64/blob/944854bca875739814cc466736f8cda5fc9b7f7d/mingw-w64-crt/crt/tls_atexit.c#L38), and this explains why llvm compiler-rt also fails here, because it also uses this part.

SchrodingerZhu avatar Jun 24 '20 09:06 SchrodingerZhu

I think further discussions are not closely related to snmalloc, I have sent this problem to the mailing list; let us just sit back and relax to see what they would suggest.

SchrodingerZhu avatar Jun 24 '20 09:06 SchrodingerZhu

@SchrodingerZhu with llvm-mingw toolchain:

$ export PATH=/opt/llvm-mingw/bin

$ clang++ mingw.cpp && ./a
dtor called 2304
dtor called 21104
dtor called 9228
dtor called 11244
dtor called 9820
dtor called 13688
dtor called 20004
dtor called 20984
dtor called 7612
dtor called 2844
dtor called 7028
dtor called 5000

There is no error.

I think further discussions are not closely related to snmalloc, I have sent this problem to the mailing list; let us just sit back and relax to see what they would suggest.

Sure, thought this info would be useful.

mati865 avatar Jun 24 '20 09:06 mati865

The ctz issues for MinGW was also affecting clang-cl, so I have done the ctz fix suggested by @davidchisnall in #242.

mjp41 avatar Aug 26 '20 16:08 mjp41

MinGW-w64 seems to have no effective respond to this problem. As other crt (llvm-mingw) do have functioning TLS, maybe we can left this as a patch? I will finally get some time to update and rebase this draft later.

SchrodingerZhu avatar Aug 27 '20 04:08 SchrodingerZhu

Well llvm-mingw is using the same mingw-w64 CRT as MSYS2 and other mingw-w64 based compilers. I think it works with that toolchain because it uses native TLS (GCC uses emutls on Windows and at MSYS2 we had to patch Clang to also do it for compatibility with GCC) and compiler-rt is not affected by the same bug as libgcc (or winpthreads which it uses internally). So it proves that there is no bug in mingw-w64 itself but within the compiler used together with it.

mati865 avatar Aug 27 '20 10:08 mati865

Well llvm-mingw is using the same mingw-w64 CRT as MSYS2 and other mingw-w64 based compilers. I think it works with that toolchain because it uses native TLS (GCC uses emutls on Windows and at MSYS2 we had to patch Clang to also do it for compatibility with GCC) and compiler-rt is not affected by the same bug as libgcc (or winpthreads which it uses internally). So it proves that there is no bug in mingw-w64 itself but within the compiler used together with it.

isn't it using universal runtime on default?

As this toolchain uses a different CRT and C++ standard library than most mingw toolchains, it is incompatible with object files and static libraries built with other toolchains. Mixing DLLs from other toolchains is supported, but only as long as CRT resources aren't shared across DLL boundaries (no sharing of file handles etc, and memory should be freed by the same DLL that allocated it). (quoted from its README.)

SchrodingerZhu avatar Aug 27 '20 18:08 SchrodingerZhu

@SchrodingerZhu any toolchain can use any CRT library (it's mingw-w64 configuration option) but it does not change anything with regard to TLS bug.

mati865 avatar Aug 27 '20 19:08 mati865

@mati865

there is no bug in mingw-w64 itself but within the compiler used together with it.

Is there a combination we should recommend for building snmalloc then?

mjp41 avatar Aug 28 '20 09:08 mjp41