Web lists-archives.com

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




[Please don't make this a personal email.]

> From: Emanuel Falkenauer <E.Falkenauer@xxxxxxxxxxxxxxxxx>
> Date: Sun, 7 May 2017 02:02:28 +0200
> 
> > How do you see that the relevant RAM is unavailable, please?  What
> > tools do you use to show that?  That's the missing piece in this
> > discussion.  Without it, I cannot tell where is the misunderstanding
> > between us.
> 
> When after just two days of uptime 10 of my 12 gigs of RAM are reported 
> "in use" by the Task Manager, then the printer disconnects by itself, 
> then the Internet disappears, and then running new programs becomes 
> generally impossible... you know something is really amiss.

That's not something that happens to me, surely.

> > Even if you are right, and DLLs loaded by a program are kept in memory
> > when the program exits, that has nothing to do with the issue at hand,
> > which is memory allocated by the program via a call to 'malloc'.
> > Memory for DLLs is allocated by the system, not by the application,
> > and so cannot be freed by the application directly.  The only thing
> > the application can do is explicitly call FreeLibrary to unload a
> > DLL.  That's a different scenario from what started this thread.
> 
> Well, you are onto something here: practically all of our stuff is in 
> DLLs! So can you explain what you mean by "Memory for DLLs is allocated 
> by the system, not by the application", i.e. what is the fundamental 
> difference between calling malloc in an exe and a DLL? In both, the 
> memory may subsequently be freed...

Simply what I wrote: when a DLL is loaded, the application doesn't
call 'malloc' to allocate the memory needed for the DLL.  So it won't
help to call 'free'.  If the DLL was loaded with LoadLibrary, you can
unload it with FreeLibrary, but if it was loaded automatically, you
cannot do even that, I think.

But before you decide that this is your problem, I suggest to make
sure that the DLLs your application loads remains in memory when the
application exits.

------------------------------------------------------------------------------
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