Previous | 199869 Revisions | Next |
r168836 Friday 2nd October, 2020 at 17:00:24 UTC by Vasantha Crabb |
---|
Got rid of global_alloc/global_free. The global_alloc/global_free functions have outlived their usefulness. They don't allow consistently overriding the default memory allocation behaviour because they aren't used consistently, and we don't have standard library allocator wrappers for them that we'd need to use them consistently with all the standard library containers we're using. If you need to change the default allocator behaviour, you can override the new/delete operators, and there are ways to get more fine-grained control that way. We're already doing that to pre-fill memory in debug builds. Code was already starting to depend on global_alloc/global_free wrapping new/delete. For example some parts of the code (including the UI and Windows debugger) was putting the result of global_alloc in a std::unique_ptr wrappers without custom deleters, and the SPU sound device was assuming it could use global_free to release memory allocated with operator new. There was also code misunderstanding the behaviour of global_alloc, for example the GROM port cartridge code was checking for nullptr when a failure will actually throw std::bad_alloc. As well as substituting new/delete, I've made several things use smart pointers to reduce the chance of leaks, and fixed a couple of leaks, too. |
[/branches/fmrewrite/src/devices/bus/adamnet] | adamnet.cpp |
[/branches/fmrewrite/src/devices/bus/cbmiec] | cbmiec.cpp |
[/branches/fmrewrite/src/devices/bus/econet] | econet.cpp |
[/branches/fmrewrite/src/devices/bus/ieee488] | ieee488.cpp |
[/branches/fmrewrite/src/devices/bus/ti99/gromport] | cartridges.cpp cartridges.h |
[/branches/fmrewrite/src/devices/bus/ti99/peb] | horizon.cpp |
[/branches/fmrewrite/src/devices/cpu] | x86log.cpp x86log.h |
[/branches/fmrewrite/src/devices/imagedev] | floppy.cpp floppy.h mfmhd.cpp mfmhd.h midiin.cpp midiin.h midiout.cpp midiout.h |
[/branches/fmrewrite/src/devices/sound] | spu.cpp spu.h spureverb.cpp spureverb.h |
[/branches/fmrewrite/src/emu] | addrmap.cpp emualloc.cpp emualloc.h ioport.cpp render.cpp render.h rendfont.h rendlay.cpp tilemap.cpp |
[/branches/fmrewrite/src/emu/debug] | debugvw.cpp |
[/branches/fmrewrite/src/frontend/mame] | clifront.cpp mame.cpp mame.h |
[/branches/fmrewrite/src/frontend/mame/ui] | menu.cpp menu.h text.cpp text.h ui.cpp ui.h |
[/branches/fmrewrite/src/lib/formats] | imd_dsk.cpp ipf_dsk.cpp ipf_dsk.h mfi_dsk.cpp |
[/branches/fmrewrite/src/lib/util] | corealloc.h coretmpl.h |
[/branches/fmrewrite/src/mame/includes] | apollo.h |
[/branches/fmrewrite/src/mame/machine] | psxcd.cpp |
[/branches/fmrewrite/src/mame/video] | apollo.cpp |
[/branches/fmrewrite/src/osd] | osdepend.h |
[/branches/fmrewrite/src/osd/modules] | osdmodule.cpp osdmodule.h |
[/branches/fmrewrite/src/osd/modules/debugger] | debugimgui.cpp |
[/branches/fmrewrite/src/osd/modules/debugger/win] | consolewininfo.cpp disasmbasewininfo.cpp logwininfo.cpp memorywininfo.cpp pointswininfo.cpp |
[/branches/fmrewrite/src/osd/modules/lib] | osdobj_common.cpp osdobj_common.h |
[/branches/fmrewrite/src/osd/modules/midi] | midi_module.h none.cpp portmidi.cpp |
[/branches/fmrewrite/src/osd/modules/netdev] | pcap.cpp taptun.cpp |
[/branches/fmrewrite/src/osd/modules/output] | win32_output.cpp |
[/branches/fmrewrite/src/osd/modules/render] | draw13.cpp draw13.h drawd3d.cpp drawd3d.h drawgdi.cpp drawgdi.h drawogl.cpp drawogl.h drawsdl.cpp drawsdl.h |
[/branches/fmrewrite/src/osd/modules/render/d3d] | d3dhlsl.cpp |
[/branches/fmrewrite/src/osd/sdl] | window.cpp window.h |
[/branches/fmrewrite/src/tools/imgtool/modules] | hp85_tape.cpp hp9845_tape.cpp |
https://github.com/mamedev/mame/commit/4f05917494b22943ab0e7c466e4eb9f7a5896daa |
Previous | 199869 Revisions | Next |