Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

sound issues Goto page Previous 1, 2, 3 Next

| Inside3d Forums Forum Index -> Engine Programming

View previous topic :: View next topic
Author | Message
--- | ---
frag.machine Joined: 25 Nov 2006 Posts: 728 |

Posted: Sat Apr 17, 2010 9:08 pm Post subject: |

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 |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Sun Apr 18, 2010 12:03 am Post subject: |

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 |

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

Posted: Sun Apr 18, 2010 3:27 am Post subject: |

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 |

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

Posted: Tue Apr 20, 2010 3:08 am Post subject: |

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 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
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 |

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

Posted: Tue Apr 20, 2010 5:12 am Post subject: |

found the bugger maxclients was'nt initialized to zero. works again now unfortunatly this had no affect on the sound problem whatsoever may have to bite the sour apple and admit that something in my compiler is bitching loudly at this

Back to top |

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

Posted: Tue Apr 20, 2010 9:55 pm Post subject: |

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 |

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

Posted: Wed Apr 21, 2010 4:19 am Post subject: |

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 i did notice a few warnings about variables allready defined elsewhere in my system headers the funny thing is these are not even included
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 |

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

Posted: Wed Apr 21, 2010 4:29 am Post subject: |

well ill be damned and someone color me red 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

Back to top |

Chip Joined: 21 Jan 2009 Posts: 314 Location: Romania |

Posted: Wed Apr 21, 2010 12:24 pm Post subject: |

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 |

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

Posted: Wed Apr 21, 2010 6:33 pm Post subject: |

it handles c/c++/ada/java so i would say yes 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 |

Chip Joined: 21 Jan 2009 Posts: 314 Location: Romania |

Posted: Wed Apr 21, 2010 11:02 pm Post subject: |

reckless wrote:
it handles c/c++/ada/java so i would say yes 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 |

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

Posted: Thu Apr 22, 2010 12:11 am Post subject: |

ill be happy to help as much as i can if any compatibility issues arise.

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Thu Apr 22, 2010 12:22 am Post subject: |

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 |

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

Posted: Thu Apr 22, 2010 4:31 am Post subject: |

oh thats evil i hope it dos'nt (phun phun) make calls to the 16 bit api else porting will be a bitch

Back to top |

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

Posted: Thu Apr 22, 2010 4:44 am Post subject: |

just downloaded it to see if there would be any buggers i couldnt work around and hello and behold it uses mfc 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 |

Display posts from previous:

| 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