Hello,

I've been spending the last 6 months on and off on bug fixing. I've boiled it down to a few, which I cannot fix.
They might both be connected with me doing something wrong with sys_malloc and sys_free commands, but I have no idea how to find this. Some of these issues I have posted before, and you offered me that I could send you the code and you would have a look at it. I did not do it at the time, because I had too many other things to finish before getting to these bugs. Does that offer still stand?
1)
Click to reveal.. (level_load crash)

Code:
posPredictDummy = NULL;
	ship = NULL;
	
	logNewMessage("loading level:",gameLog,OFF);
	logNewMessage(level, gameLog, OFF);
	
	sys_marker("ls0");
	level_load(level); //loads the level which has been loaded on the server
	sys_marker("ls1");
	camEnt = NULL;
	wait(1);
	sc_shadows_sunLookAt = ent_create(NULL,nullvector,NULL);		//important: if missing, shadeC will move random objects next round.

	wait(3); //wait until the level is loaded
	sys_marker("ls2");
	if(disconnectedFromServer) return;


Here, I sometimes get a "crash in level_load 'ls0'". As I have no idea what exactly level_load does, I have no clue how to fix this.

2)
The second one is a crash in ent_remove. This happens in 3 (rather unrelated) functions, seemingly at random.
First example (crashes in se6):
Click to reveal..
Code:
void shieldEffectEnt()
{
	var randID = random(9999);
	logNewValue("shieldEffectEnt", randID, debugLog, OFF);
	logNewValue("my:", my, debugLog, OFF);
	sys_marker("se0");
	set(my,PASSABLE);
	vec_set(my.pan,vector(you.lastHitPan, you.lastHitTilt,0));
	my.flags2 |= UNTOUCHABLE;
	
	my_playsound(my,shieldHitOGG, volumeMain*volumeFX*500*soundBrightFlash);
	sys_marker("se1");
	my.parent = you;
	//sc_ent_shieldImpact(my, getShieldEffectColor(you.shieldEffectType), 15, 1);

	var timePassed = 0;
	while(my != NULL && you != NULL && timePassed < 8)
	{
		sys_marker("se3");
		timePassed += time_frame;
		vec_set(my.x, you.x);
		sys_marker("se4");
		wait(1);
	}
	sys_marker("se2");
	logNewValue("shieldEffectEnt", randID, debugLog, OFF);
	logNewValue("my:", my, debugLog, OFF);
	sys_marker("se5");	
	if(my) 
	{
		sys_marker("se6");
		ent_remove(my);
	}
	sys_marker("se8");
}


Second example of ent_remove crash (crashes in w31):
Click to reveal..
Code:
weaponArray[userID*7 + you.upgradeType - 1] = NULL;
			sys_marker("w29");
			if(snd_playing(lightningGunSound[userID])) snd_stop(lightningGunSound[userID]);
			sys_marker("w30");
			if(snd_playing(machineGunSound[userID])) snd_stop(machineGunSound[userID]);
			sys_marker("w31");
			if(you) ent_remove(you);
			sys_marker("w32");
		}


The third problem is that the debugger crashes on me with an error message "out of memory". I have 4 gigabytes of RAM (can use about 3.1 of that, since my PC is a 32 bit machine) and my game takes a max of 1, usually. This one we have talked about before, and you asked me to send you my code.

P.S. I use Version 7.86.6
Edit: Here's what I've tried regarding the ent_remove problem: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=395538#Post395538

Last edited by Germanunkol; 03/03/12 14:26.

~"I never let school interfere with my education"~
-Mark Twain