public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* re: memory allocation
@ 2003-09-13 15:00 Dan Kegel
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Kegel @ 2003-09-13 15:00 UTC (permalink / raw)
  To: GCC Mailing List, gcc-help, laczo.tibor

Laczó Tibor wrote:
[ In Redhat Linux, how come calling delete on objects in C++
   doesn't return memory to the operating system?  Even after
   my program deletes all its big objects, RSS doesn't shrink. ]

That's an FAQ.  http://www.lysator.liu.se/c/c-faq/c-3.html says
Q. I have a program which mallocs but then frees a lot of memory,
but memory usage (as reported by ps) doesn't seem to go back down.
A. Most implementations of malloc/free do not return freed memory to
the operating system (if there is one), but merely make it available
for future malloc calls within the same process.

glibc's manual also mentions this:
http://www.gnu.org/manual/glibc-2.2.5/html_node/Freeing-after-Malloc.html#Freeing%20after%20Malloc
which says
"Occasionally, free can actually return memory to the operating system
and make the process smaller. Usually, all it can do is allow a
later call to malloc to reuse the space. In the meantime,
the space remains in your program as part of a free-list used internally by malloc."

Please take this discussion to gcc-help@gcc.gnu.org
or maybe comp.lang.c++.

gcc@gcc.gnu.org is for gcc maintainers, not users.
- Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045

^ permalink raw reply	[flat|nested] 11+ messages in thread
* memory allocation
@ 1999-11-04  2:15 Anand Ganesh
  1999-11-04  3:00 ` Martin Kahlert
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Anand Ganesh @ 1999-11-04  2:15 UTC (permalink / raw)
  To: help-gcc

Hi,
	Why doesnt gcc crib when I make an array declaration that it cant
handle ?
eg
float array[10000][5][5];

That there is a problem I realised b'cos some unrelated variables were
getting changed. The reason I declared such an array instead of mallocing
is that it is easier to pass 3D arrays rather than float*** which you cant
use as a 3D array anymore (since dimensions are not known).

Is there a way to get a warning from gcc ? (I did gcc -Wall)

Thanks in advance for any help,
ag.

	


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-09-19  2:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CANEcUBX9ntHdZ7qEJg7ke=MADcxfP_uOwNnA==XvKbf3kyH1Lw@mail.gmail.com>
     [not found] ` <CAKOQZ8zsfKUFv0PDhUmDWDgqD9p-xMYUfW_eR9B-TWx5yjmjeQ@mail.gmail.com>
2013-09-19  1:04   ` memory allocation zhaobin xv
2013-09-19  2:38     ` Ian Lance Taylor
2003-09-13 15:00 Dan Kegel
  -- strict thread matches above, loose matches on Subject: below --
1999-11-04  2:15 Anand Ganesh
1999-11-04  3:00 ` Martin Kahlert
1999-11-30 23:28   ` Martin Kahlert
1999-11-04  6:16 ` Arthur Gold
1999-11-05 14:01   ` Anand Ganesh
1999-11-30 23:28     ` Anand Ganesh
1999-11-30 23:28   ` Arthur Gold
1999-11-30 23:28 ` Anand Ganesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).