From: Kyle C. <kc...@pr...> - 2001-10-14 05:58:52
|
Hi! Okay, this is a little unorthodox, but I found something recently while installing Xine on my box for the first time. Let mem preface this, by saying that I do not follow xine development, but just happened to find this in the most recent release (0.9.1). I hope someone has already found this, but just in case, I thought I'd let you all know :-) While browsing the source code, I ran across an incorrect calculation (or, at least I assume so, the code (v 0.9.1) has few comments). In the xine-lib source tarball, the file src/xine-engine/buffer.c, line 230 (or there about) appears to be adjusting a requested buffer size, before passing it to malloc. The line reads: bufsize += bufsize % alignment; From what I can tell, the purpose of this line is to increment buff size to a multiple of alignment, perhpas to limit internal fragmentation of ram. Well, a quick calculation shows this to be in error. To wit: bufsize += bufsize % alignment bufsize = 4521, alignment = 2048 bufsize % alignment = 425 bufsize + 425 = 4946 bufsize / alignment =2.4150309063 obviously, bufsize is not a multiple of alignment. The theory behind the calculation was correct (ie you can use the modulus to find the nearest multiple), but it was not implemented correctly. The line should read: bufsize += alignment - (bufsize % alignment); If you want to see why this is right, send me mail, and I'll ramble more about it- but it should be easy to see. I didn't bother to check, but this could cause performance problems and/or memory leaks. So I thought I should let someone know. Anyway, thank you for xine. Its awesome. Great work! Let me know it this helps! Kyle Centers. -- _______________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup Have you downloaded the latest calling software from Net2Phone? Click here to get it now! http://www.net2phone.com/cgi-bin/adforward.cgi?p_key=NH211JK&url=http://commcenter.net2phone.com/ |