From: leo mueller <llug.dan@googlemail.com>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: problems with free()
Date: Tue, 28 Apr 2009 14:52:09 +0200 [thread overview]
Message-ID: <c93f91ee0904280552u12f4ba4ey5eca1ac0fccbc07d@mail.gmail.com> (raw)
In-Reply-To: <36ca99e90904280422u243af682qe2ea0efc4b6a4984@mail.gmail.com>
yeah, i was just wondering why doing a free() on the last example (the
char* stuff...) decreased the used mem by 'a.out' _immediately_ and on
my first example (source attached in 1st mail) _not_ (nothing happened
after free; only the os cleaned up after exit). i tried that several
times and got the same behaviour as mentioned, so i thought there
might be a bug in my source....
another fact would proof my assumption....
during programming (on that source) i first cleaned up my mem
recursively... which ended up in segfault when allocating more than
(e.g.) 1.5gig over the time, so a stack overflow might occur. instead
of
traversing my built tree recursively, i thought about putting the
lists with nodes (my 'parts' of the tree) into a linked list to solve
this issue. but i'm wondering about the following fact... freeing
recursivly made a visible decrease of my used mem in 'htop' while
freeing with my iterative variant made no decrease at all... so i
thought about a bug in my program... (but cannot find it....)
2009/4/28 Bert Wesarg <bert.wesarg@googlemail.com>:
> On Tue, Apr 28, 2009 at 11:20, leo mueller <llug.dan@googlemail.com> wrote:
>> hi all,
>>
>> i got a little problem with free() ... i am allocating mem for a
>> special struct and putting it afterwards
>> into a linked list. allocating works fine, but freeing not. i'm
>> tracking the program with htop. after
>> allocating, the percentage of mem usage stays constant ...
> Can you at least describe what do you expect to happen, and what does
> not work with freeing?
>
> bert
>>
>> the test-file is attached.
>>
>> any help is appreciated. big thanks :)
>>
>
prev parent reply other threads:[~2009-04-28 12:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c93f91ee0904280218o2f844cd0u2262db407ca8f468@mail.gmail.com>
2009-04-28 9:20 ` problems with free() leo mueller
[not found] ` <6eee1c40904280341n4e332026i7d9800fd4f8059b4@mail.gmail.com>
2009-04-28 11:10 ` leo mueller
2009-04-28 14:48 ` Trevor Woollacott [ MTN - Innovation Centre ]
2009-04-28 11:22 ` Bert Wesarg
2009-04-28 12:52 ` leo mueller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c93f91ee0904280552u12f4ba4ey5eca1ac0fccbc07d@mail.gmail.com \
--to=llug.dan@googlemail.com \
--cc=bert.wesarg@googlemail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).