summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/corealloc.h
Commit message (Collapse)AuthorAgeFilesLines
* -util/corealloc.h: Reduced make_unique_clear to a single variant for POD arrays. Vas Crabb2022-04-031-31/+14
| | | | | | | | | | | | | | | | | | * Enabled GCC lifetime dead store elimination optimisation. * emu/device.h: Don't pre-clear memory for drivers. Ivan Vangelista fixed at least the majority of things that crashed outright, and Robbbert initialised variables that coverity complained about. It's unlikely anything will break due to this. * sound/discrete.h: Explicitly initialise members of discrete "devices" to zero. I don't see a way around doing this in headers due to the macro soup used to build the constructors. * sound/mos6581.cpp: Moved creation of the SID core to device_start and explictly initialised members of the SID core structures. These structures are in internal headers, so they won't cause downstream recompiles. -Lua engine: Made I/O port manager type_seq a bit more tolerant of omitted arguments.
* Low-level #include overhaul AJR2021-01-021-2/+0
| | | | | | | - vecstream.h: Revert changes made in aa29519528cb3dbdbfac56819bea670ed8c56c5d. The std::string_view conversion has been made a non-member function (util::buf_to_string_view) and moved to coretmpl.h. - strformat.h: Remove the using declaration importing util::string_format into the global namespace. It has been moved to emucore.h and a few tool sources; other references have been qualified. - osdcore.h: Split out file, directory and path classes and methods to a new header (osdfile.h), Doxygenizing the documentation comments. - Disaggregate many #includes that were including other standard or custom headers. emu.h now includes basically the same things that it did, but other headers have been streamlined; for instance, emucore.h no longer stealth-includes osdcore.h several ways.
* Got rid of global_alloc/global_free. Vas Crabb2020-10-031-35/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* use C++ library includes (nw) firewave2020-01-221-1/+1
|
* misc cleanup: Vas Crabb2019-11-181-2/+0
| | | | | | | * Got rid of some more simple_list in core debugger code * Fixed a buffer overrun in wavwrite (buffer half requried size) * Slightly reduced dependencies and overhead in wavwrite * Made new disassembly windows in Qt debugger default to current CPU
* misc fixes (nw) Vas Crabb2016-05-281-38/+26
| | | | | | * fix a mismatched new[]/delete error in corealloc * _name massacre in corealloc while at it * add template/macro for delaring array with equivalent dimensions
* Fix many valgrind Mismatched free() / delete / delete [] errors Vas Crabb2016-03-211-16/+21
|
* Small code cleanup: dankan18902016-01-291-0/+2
| | | | | | | | | - corealloc.h: added macro definition for global_alloc (nothrow) memory allocation. - textbuf.cpp / wavwrite.cpp: removed pointless cast. - debugcmd.cpp / luaengine.cpp / render.cpp: avoid strlen calls in a loop. - diimage.cpp: simplified "device_image_interface::set_image_filename" function. - miscmenu.cpp / selgame.h / video.cpp(h): replaced int with bool where applicable. - ui.cpp: removed unused code.
* Cleanups and version bumpmame0170 Miodrag Milanovic2016-01-271-3/+3
|
* make make make_unique_clear accept all kind of parameters (nw) Miodrag Milanovic2016-01-081-2/+54
|
* removed memory tracking (nw) Miodrag Milanovic2016-01-081-74/+19
|
* Add realloc implementation as required by the C standard (nw) balr0g2016-01-021-1/+5
|
* Revert "Comment this, so OSX can compile" Miodrag Milanovic2016-01-011-1/+1
| | | | This reverts commit 2a6af208d6638103d4ca285f7a0f5e3fa5afa75a.
* Comment this, so OSX can compile Miodrag Milanovic2016-01-011-1/+1
|
* Fix to make VS2015 release builds possible (nw) Miodrag Milanovic2015-10-241-2/+6
|
* Revert "Placed back old corealloc otherwise NO_MEM_TRACKING do not have any ↵ balr0g2015-06-071-19/+9
| | | | | | | meaning (nw)" (Requested by R.Belmont since this breaks build with GCC 5.1.) This reverts commit aae343fcedb49943bbcadeda9f3ad41172b6eecb.
* Nope. (nw) balr0g2015-06-071-4/+4
| | | | | | This reverts commit 72794f8ff1c1e79bd0350bb52fb3757bdf04d004. At least this provides a more useful stacktrace, if anyone wants to debug.
* Use attribute unused for inlined new/delete. (nw) balr0g2015-06-071-4/+4
| | | | | | This is still not compliant code, and will probably break with LTO, but is a cleaner fix for the warning. Using this attribute also ensures that the linker doesn't remove the code.
* Placed back old corealloc otherwise NO_MEM_TRACKING do not have any meaning (nw) Miodrag Milanovic2015-06-071-9/+19
|
* Mark replacements separate from overloads and remove unneeded prototypes (nw) balr0g2015-05-161-10/+0
|
* Remove nonstandard inline overloads (nw) balr0g2015-05-161-13/+13
|
* re-applied safe corealloc changes (nw) Oliver Stöneberg2014-05-161-12/+0
|
* Revert of r30457 per Micko (nw) Scott Stone2014-05-151-2/+14
|
* corealloc adjustments: Oliver Stöneberg2014-05-151-14/+2
| | | | | - re-enabled default memory initialization in DEBUG builds (should make random crashes less random) - moved defines from header to source since they are only used locally and not globally - added file/line information to global_free* and fixed src/emu/sound/spu.c compilation
* fixed GCC/clang compilation / fixed some forward declarations (nw) Oliver Stöneberg2014-03-111-0/+1
|
* Moved core template container classes up from emutempl.h to coretmpl.h: Aaron Giles2014-03-111-0/+121
[Aaron Giles] * these classes now no longer take a resource_pool; everything is managed globally -- this means that objects added to lists must be allocated with global_alloc * added new auto_pointer<> template which wraps a pointer and auto-frees it upon destruction; it also defaults to NULL so it doesn't need to be explicitly initialized * moved tagged_list template to tagmap.h Redo of the low-level memory tracking system: [Aaron Giles] * moved low-level tracking out of emu\emualloc into lib\util\corealloc so it can be shared among all components and used by core libraries * global_alloc and friends no longer use a resource pool to track allocations; turns out this was a wholly redundant system that wasted a lot of memory * removed global_resource_pool entirely * added global_free_array to delete arrays allocated with global_alloc_array * added tracking of object versus array allocation; we will now error if you use global_free on an array, or global_free_array on an object Added new utility helper const_string_pool which can be used to efficiently accumulate strings that are not intended to be modified. Used by updated makelist and software list code. [Aaron Giles] Updated png2bdc and makelist tools to not leak memory and use more modern techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles] Deprecated auto_strdup and removed all uses by way of caller-managed astrings and the software list rewrite. [Aaron Giles] Rewrote software list management: [Aaron Giles] * removed the notion of a software_list that is separate from a software_list_device; they are one and the same now * moved several functions into device_image_interface since they really didn't belong in the core software list class * lots of simplification as a result of the above changes Additional notes (no whatsnew): Moved definition of FPTR to osdcomm.h. Some changes happened in the OSD code to fix issues, especially regarding freeing arrays. SDL folks may need to fix up some of these. The following devices still are using tokens and should be modernized (I found them because they kept their token as void * and tried to delete it, which you can't): namco_52xx_device (mame/audio/namco52.c) namco_54xx_device (mame/audio/namco54.c) namco_06xx_device (mame/machine/namco06.c) namco_50xx_device (mame/machine/namco50.c) namco_51xx_device (mame/machine/namco51.c) namco_53xx_device (mame/machine/namco53.c) voodoo_device (emu/video/voodoo.c) mos6581_device (emu/sound/mos6581.c) aica_device (emu/sound/aica.c) scsp_device (emu/sound/scsp.c) dmadac_sound_device (emu/sound/dmadac.c) s3c2440_device (emu/machine/s3c2440.c) wd1770_device (emu/machine/wd17xx.c) latch8_device (emu/machine/latch8.c) duart68681_device (emu/machine/68681.c) s3c2400_device (emu/machine/s3c2400.c) s3c2410_device (emu/machine/s3c2410.c) strataflash_device (mess/machine/strata.c) hd63450_device (mess/machine/hd63450.c) tap_990_device (mess/machine/ti99/990_tap.c) omti8621_device (mess/machine/omti8621.c) vdt911_device (mess/video/911_vdt.c) apollo_graphics_15i (mess/video/apollo.c) asr733_device (mess/video/733_asr.c)