[ オリジナルレポート ]

BugID: #03746

カテゴリ 重要度 ステータス 解決状況 登録日時 最終更新
システムコア解決済み修正済み2010-02-24 04:122010-02-28 22:45
 
テスターpingbak担当者couriersudソース
バージョン0.136u3発生バージョン修正バージョン0.136u4
フラグデバッグビルド限定
セット
セット詳細
 
概 要オーバーロードしたoperator newとoperator delete動作が厳しすぎてMacOSでクラッシュする。
詳 細This isn't hard to reproduce, at least on the Mac OS X platform. When compiled with MAME_DEBUG set, sdlmame will crash. The problem is that this is likely not specific to sdlmame, but to the design decision to overload operator new and operator delete globally and to abort if the deleted pointer is not found in the tracked set of pointers.

Basically, this design needs to be more permissive -- it should not abort on a perceived allocation error. Complain about it, sure. Abort, not a good choice. The reason is that there are long standing bugs in every vendor's system libraries that wont be corrected. A good example of this is libGLUT (GL utilities library). Other examples abound, such as the common mistake of calling 'delete' instead of 'delete []' (which might be happening in this case, but can't tell for sure.)

I've got some experience with writing debugging malloc and overloading operator new/delete; I was an early contributor to and tester of Gray Watson's "dmalloc" library. "dmalloc" is still used by many to find allocation problems. 'valgrind' on the Linux platform is also a good way to locate allocation issues.

Customized new/delete that passes extra parameters for source file and line is reasonable because that would only affect mame source where it is used. Overloading the global versions is a maintenance headache.
再現手順 
追加情報Another good reason to rethink global operator new/delete: delete has different declarations on different versions of gcc, viz:

operator delete(void *);

vs.

operator delete(void *) throw();

The declarations are not strictly the same.
 
添付ファイル