public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Martin Velek <martin.velek@gmail.com>
To: "Kapania, Ashish" <akapania@ti.com>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: Possible bug in __sfp() libc routine
Date: Sun, 09 Apr 2017 09:22:00 -0000	[thread overview]
Message-ID: <CAB-o4Cx-9+mhRyNQr9T85LDxDdFM=tTopH9YQHnmZQD7KsDfTw@mail.gmail.com> (raw)
In-Reply-To: <C0BBAD24E8CD0E4B8A8BD70B11D9544415CB3BBA@DFLE08.ent.ti.com>

What about this thread?

https://sourceware.org/ml/newlib/2015/msg00619.html . I think this
issue was not fixed or commented yet.

I have written some info related to newlib, reentrancy
(--enable-newlib-reent-small) and using it in FreeRTOS, however the
biggest issue is that it is written in Czech language with no
perspective to be translated into English. I have tried
translate.google.com and it is somehow cumbersome.
https://support.dce.felk.cvut.cz/mediawiki/images/1/17/Dp_2016_velek_martin.pdf

BR
Martin

On Fri, Apr 7, 2017 at 11:57 PM, Kapania, Ashish <akapania@ti.com> wrote:
> Hi All,
>
> In the __sfp() function in "libc/findfp.c" file, I see that if no free FILE object is found, one is allocated and put on a list in the global re-entrancy structure (_GLOBAL_REENT). This seems like a bug to me. I believe the FILE object should be put on a list in the thread specific reentrancy structure. If I create a thread, do a fopen, do a fwrite (invokes __sfp which in turn allocates the FILE object), do a fclose and then delete the thread, the FILE object allocated by __sfp() is not freed. If a do this sequence repeatedly, I see memory keeps leaking until my app runs out of heap. I have a separate re-entrancy structure for each thread but because the FILE object is not in a list on the local re-entrancy structure, it does not get freed when I delete the thread and run _reclaim_reent() on the local reentrancy structure.
>
> Any thoughts ?
>
> Best,
> Ashish

  parent reply	other threads:[~2017-04-09  9:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 21:58 Kapania, Ashish
2017-04-08 21:04 ` Freddie Chopin
2017-04-10 19:53   ` Kapania, Ashish
2017-04-11 11:52     ` AW: " onkel.jack
2017-04-09  9:22 ` Martin Velek [this message]
2018-01-19  0:31   ` Kapania, Ashish
2017-04-07 22:02 Kapania, Ashish

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='CAB-o4Cx-9+mhRyNQr9T85LDxDdFM=tTopH9YQHnmZQD7KsDfTw@mail.gmail.com' \
    --to=martin.velek@gmail.com \
    --cc=akapania@ti.com \
    --cc=newlib@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).