Web lists-archives.com

Re: [Mingw-users] CRT lib: potential memory leakage




On Fri, 05 May 2017 16:15:36 +0300, Eli Zaretskii wrote:

> First, what is the purpose of freeing memory just before the program exits?
> That memory will be freed by the OS anyway.

I was wondering if this was a leakage, so I simply plugged the free line into
the sample program for demonstration purposes only. As you say it isn’t leakage 
in the MinGW control area. Do you happen to know about any relatively easy 
reading material about what the OS is doing at start up and at termination?
 
> And second, the argv array is not allocated by the MinGW runtime, it is
> allocated by MSVCRT.DLL, the Windows CRT shared library.  Since we have
> no idea how it is allocated, calling 'free' on it in your program is a bad idea,
> because you cannot be sure it was allocated by a call to the same 'malloc'
> version that corresponds to the 'free' you want to use.
> 
> IOW: don't do that!

OK - understood. Many thanks.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe