Inside3D!
     

sound issues
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Sat Apr 17, 2010 9:08 pm    Post subject: Reply with quote

mh wrote:
Spike wrote:
Thirdly, the behaviour of malloc differing between debug/release/compiler is a GOOD thing. Any memory bug you have is a memory bug. Generally involving breaking other bits of memory. Change some code somewhere and you get random differences elsewhere. Sure, okay, memory working the same way as debug builds always is easier, but results in minor errors that you'll never find. A malloc that is random every time is awesome.
Additionally, you can link your app against a third-party library that provides such debugging features instead of having to roll your own.

It depends. If the debug behaviour has tighter validation and constraints then yeah it's a good thing. If on the other hand you have a situation where debug malloc memsets 0 whereas release malloc doesn't, you've got a backdoor for subtle bugs to come in, and your debug build is effectively worthless for verifying correctness of your release build.


AFAIK this behavior is restrict to Microsoft's implementation and no other C runtime does this "automatic memset to 0 when malloc'ing" stuff in debug mode. Not to mention that it's both an useless performance penalty and a nasty way to induce novice (and even experienced) programmers in error.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Sun Apr 18, 2010 12:03 am    Post subject: Reply with quote

msvc's debug malloc memsets to 0xcc (which is the x86 int3 debugging opcode).
Other compilers tend not to use different libraries for debug or release builds. You can force it though, or in linux, just use LD_PRELOAD.

With release builds, most secure operating systems will memset to 0 the first time you start it up. Well, less memset, more clear out for the sake of security. Of course, this only works the first time you use a page, rather than an actual allocation, as its the heap that is cleared, not the allocations. This means its quite likely you won't notice that its not cleared in a release build.

Anyway, point is, malloc > rewriting malloc, even if you wrap it. If you want cleared memory, use calloc instead.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Sun Apr 18, 2010 3:27 am    Post subject: Reply with quote

yikes well as for strange stuff that can happen with bad memory pointers as i just found out the hard way.

command buffer goes boom literally last char of any command gets cut of example toggleconsole now fails with toggleconsol unknown command.
same for cvars.

keybindings also affected erf looks like i will have to redo the entire thing from scratch.
Back to top
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Tue Apr 20, 2010 3:08 am    Post subject: Reply with quote

fixed the command crap now im left with the SZ_GetSpace errors

basically this happens whenever i try to load a map SZ_GetSpace 1 > max buffer size Evil or Very Mad

well i dont quite get that one as the starting buffer is 256 bytes wide but an integer size of one is larger than it wtf Shocked

the only place i been able to hunt it down to is from some call to Msg_WriteByte the debugger stalls there however so bleargh.

might have to rewrite these functions to actually print the name of the function it failed in.
Back to top
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Tue Apr 20, 2010 5:12 am    Post subject: Reply with quote

found the bugger maxclients was'nt initialized to zero.

works again now unfortunatly this had no affect on the sound problem whatsoever Sad

may have to bite the sour apple and admit that something in my compiler is bitching loudly at this Embarassed
Back to top
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Tue Apr 20, 2010 9:55 pm    Post subject: Reply with quote

changed the malloc calls that initialize to zero to calloc and works quite good.

still stuck on sound will try and look into an older darkplaces with migw support for anything i missed,
Back to top
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Wed Apr 21, 2010 4:19 am    Post subject: Reply with quote

well its definatly compiler related as i just tried linking with the ms sdk libraries (works fine) but it still sounds like a frying pan with popcorn on it Laughing

i did notice a few warnings about variables allready defined elsewhere in my system headers the funny thing is these are not even included Shocked

one thing i came about thinking off was your quakeasm library i believe some of the sound system comes from this ?

allthough not sure i wonder if the ms compiled asm code somehow freaks out the gcc compiler hmm
Back to top
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Wed Apr 21, 2010 4:29 am    Post subject: Reply with quote

well ill be damned and someone color me red Shocked it was indeed the quakeasm library after removing it and enabling the corresponding c functions the thing runs like hell on ice and sound works yay Very Happy
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Wed Apr 21, 2010 12:24 pm    Post subject: Reply with quote

Here's a C-newb question.

Can I use your compiler as a standalone solution for C-based programs? I'd be interested in building the Qoole source, the one that's freely available. What about C++?
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Wed Apr 21, 2010 6:33 pm    Post subject: Reply with quote

it handles c/c++/ada/java so i would say yes Wink

as for qoole not sure what compiler was used for it in the past but with some setup it should definatly be buildable with this.
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Wed Apr 21, 2010 11:02 pm    Post subject: Reply with quote

reckless wrote:
it handles c/c++/ada/java so i would say yes Wink

as for qoole not sure what compiler was used for it in the past but with some setup it should definatly be buildable with this.


I'll give it a shot and I'll let you know!
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Thu Apr 22, 2010 12:11 am    Post subject: Reply with quote

ill be happy to help as much as i can if any compatibility issues arise.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Apr 22, 2010 12:22 am    Post subject: Reply with quote

from what I remember, qoole was originally a dos program.

so this should be fun.
its already been ported once, so chances are it'll be the libraries used, rather than the code itself that present any issues.
may also need a makefile. *shudder*.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Thu Apr 22, 2010 4:31 am    Post subject: Reply with quote

oh thats evil Twisted Evil

i hope it dos'nt (phun phun) make calls to the 16 bit api else porting will be a bitch Smile
Back to top
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Thu Apr 22, 2010 4:44 am    Post subject: Reply with quote

just downloaded it to see if there would be any buggers i couldnt work around and hello and behold it uses mfc Sad

it might be possible if you can link against the mssdk's mfc libraries but i suspect that wont be very easy.

tbh your better of with msvc in this case.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group