Please unsubscribe me On Wed, Apr 1, 2015 at 7:32 PM Mike Hommey <m...@glandium.org> wrote:
> And now, nsMemory::Alloc, nsMemory::Free and nsMemory::Realloc are gone > as well. > > Mike > > On Tue, Mar 31, 2015 at 02:59:20PM +0900, Mike Hommey wrote: > > Hi, > > > > In the next few weeks, there is going to be a reduction in the number of > > our memory allocator wrappers/functions, for essentially the following > > reasons: > > - we have too many of them, > > - developers rarely know which one to use, which results in: > > - developers often make mistakes[1] > > > > This started today with the landing of bug 1138293, which effectively > > removed moz_malloc, moz_realloc, moz_calloc and moz_free. > > > > They were replaced, respectively, with malloc, realloc, calloc and free, > > because that works™. > > > > If you have pending patches that use moz_malloc, moz_realloc, > > moz_calloc, moz_free, you can just remove the moz_ prefix. > > > > The infallible moz_xmalloc, moz_xrealloc and moz_xcalloc still do exist, > > and memory allocated with them can be freed with free. > > > > With that being said, please refrain from using any of the functions > > mentioned above. Please prefer the C++y new and delete. new is > > infallible by default (equivalent to moz_xmalloc). If you need an > > equivalent to moz_malloc, use fallible new instead: > > > > new (fallible) Foo() > > > > Please note that this shouldn't make uplifting harder. Platform patches > > using malloc/free/new/delete should apply and work just fine on beta, > > aurora and esr (with a few exceptions ; if you uplift something from > > mfbt/mozglue that uses the memory allocator, please check with me). > > > > Cheers, > > > > Mike > > > > > > 1. if you look for it, you'll find cases of one family used for > > allocation and another for deallocation, for possibly close to all > > combinations of families (NS_Alloc, nsMemory, moz_malloc, malloc, > > new). > > _______________________________________________ > > dev-platform mailing list > > dev-platform@lists.mozilla.org > > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform