We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2901

Summary: Crash inside Mix_DoEffect, memory allocation (irregular, hard to reproduce)
Product: SDL_mixer Reporter: Piotr Kosek <piotr-kosek>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 2.0.0   
Hardware: x86_64   
OS: Windows 7   

Description Piotr Kosek 2015-03-09 17:46:10 UTC
The problem is very irregular, it happens after 10-30 minutes of running of my game (longer when under debugger) and I didn't found a way to reproduce it on smaller code and in shorter amount of time. The crash seems to happen in the same place however.

Newest (2.0.3) stable SDL compiled from source to get Visual Debugging Symbols and source code trace.

Call Stack:

 	SDL2.dll!tmalloc_large(malloc_state * m, unsigned int nb) Line 3825
 	SDL2.dll!SDL_malloc_REAL(unsigned int bytes) Line 4251
 	SDL2.dll!SDL_malloc(unsigned int a) Line 409
>	SDL2_mixer.dll!Mix_DoEffects(int chan, void * snd, int len) Line 282
 	SDL2_mixer.dll!mix_channels(void * udata, unsigned char * stream, int len) Line 360
 	SDL2.dll!SDL_RunAudio(void * devicep) Line 483
 	SDL2.dll!SDL_RunThread(void * data) Line 282
 	SDL2.dll!RunThread(void * data) Line 85
 	SDL2.dll!RunThreadViaCreateThread(void * data) Line 94
 	[External Code]	

Local variables in top four functions:

in SDL2.dll!tmalloc_large(malloc_state * m, unsigned int nb) Line 3825:

	F	0x00ffffff {prev_foot=??? head=??? fd=??? ...}	malloc_tree_chunk *
	K	2550136832	unsigned int
	T	0x06d9f178 {prev_foot=16392 head=3681 fd=0x00ffffff {prev_foot=??? head=??? fd=??? ...} ...}	malloc_tree_chunk *
	I	7	unsigned int
	H	SDL2.dll!0x0f8cd8a0 {0x06d9f178 {prev_foot=16392 head=3681 fd=0x00ffffff {prev_foot=??? head=??? fd=...} ...}}	malloc_tree_chunk * *
	TP	0x06d9f178 {prev_foot=16392 head=3681 fd=0x00ffffff {prev_foot=??? head=??? fd=??? ...} ...}	malloc_tree_chunk *
	r	0x06d9f178 {prev_foot=16392 head=3681 fd=0x00ffffff {prev_foot=??? head=??? fd=??? ...} ...}	malloc_chunk *
	m	0x0f8cd758 {SDL2.dll!malloc_state _gm_} {smallmap=2223932420 treemap=191965 dvsize=728 ...}	malloc_state *
	nb	16392	unsigned int
	t	0x00000000 <NULL>	malloc_tree_chunk *
	idx	12	unsigned int
	rsize	3680	unsigned int
	v	0x06d9b170 {prev_foot=0 head=16395 fd=0x06d9b170 {prev_foot=0 head=16395 fd=0x06d9b170 {prev_foot=0 ...} ...} ...}	malloc_tree_chunk *

in SDL2.dll!SDL_malloc_REAL(unsigned int bytes) Line 4251:

	nb	16392	unsigned int
	mem	0x002cfc60	void *
	bytes	16384	unsigned int

in SDL2_mixer.dll!Mix_DoEffects(int chan, void * snd, int len) Line 282:

	chan	0	int
	snd	0x7edf5f08	void *
	len	16384	int
	e	0x02d9e1d0 {callback=0x00182a30 {SDL2_mixer.dll!_Eff_position_s16lsb(int, void *, int, void *)} done_callback=...}	_Mix_effectinfo *
	buf	0x7edf5f08	void *
	posteffect	0	int

in SDL2_mixer.dll!mix_channels(void * udata, unsigned char * stream, int len) Line 360:

	remaining	16384	int
	index	0	int
	udata	0x00000000	void *
	stream	0x002c38e8 ""	unsigned char *
	len	16384	int
	mixable	16384	int
	volume	0	int
	mix_input	0x00000000 <NULL>	unsigned char *
	sdl_ticks	2699790	unsigned int
	i	0	int