#1971 closed defect (fixed)

Memory leak in tmpfile()

Reported by: Andrey Mozzhuhin Owned by: Chris Johns
Priority: normal Milestone: 5.1
Component: fs Version: 4.11
Severity: normal Keywords:
Cc: joel.sherrill@…, sebastian.huber@…, gedare@… Blocked By:
Blocking:

Description (last modified by Chris Johns)

Hello,

I use tmpfile() in my RTEMS application, and found that it has memory leak.
I wrote small test application (see attachment), that output memory usage:

Memory usage before:
Number of used blocks: 12
Largest used block: 1288
Total bytes used: 3628

Memory used after:
Number of used blocks: 1013
Largest used block: 1288
Total bytes used: 112064

By 1000 iteration, each call tmpfile() cause memory leak about 108 bytes.

Attachments (1)

init.c (1.3 KB) - added by Andrey Mozzhuhin on 11/24/11 at 13:50:41.
Test application

Download all attachments as: .zip

Change History (16)

Changed on 11/24/11 at 13:50:41 by Andrey Mozzhuhin

Attachment: init.c added

Test application

comment:1 Changed on 04/11/14 at 19:33:28 by Gedare Bloom

Resolution: fixed
Status: newclosed, gedare@rtems.org

comment:2 Changed on 04/14/14 at 06:02:01 by Sebastian Huber

Milestone: 4.114.12
Resolution: fixed
Status: closedreopened, sebastian.huber@embedded-brains.de

comment:3 Changed on 04/14/14 at 15:37:59 by Joel Sherrill

Cc: Joel Sherrill added

comment:4 Changed on 04/16/14 at 05:21:26 by Andrey Mozzhuhin

I think real memory leak was fixed. How we can see in first memory trace after 1000 tmpfile() was allocated 1000+1 block. In Gedare memory trace after test was allocated 1 block. This block probably allocated at first tmpfile() for some initialization.

I can try to find out this 1 block allocation and write test but it can take a long time.

Not for license wars, this attached application is too simple to licensing and can be written by any RTEMS developer. Nonetheless, formalities for I give all rights on attached test application to Joel Sherrill.

comment:5 Changed on 11/20/14 at 03:27:43 by Chris Johns

Description: modified (diff)
Milestone: 4.124.11

comment:6 Changed on 12/19/14 at 04:38:14 by Gedare Bloom

Milestone: 4.114.11.1

Bump milestone to 4.11.1 in case no patch exists and PR seems delayable.

comment:7 Changed on 01/26/17 at 07:16:00 by Sebastian Huber

Milestone: 4.11.14.11.2

comment:8 Changed on 03/23/17 at 01:03:28 by Chris Johns

Milestone: 4.11.24.11.3

The 4.11.2 milestone is closing.

comment:9 Changed on 03/23/17 at 01:05:42 by Chris Johns

Version: 4.104.11

Move to the 4.11 branch.

comment:10 Changed on 02/05/18 at 05:56:05 by Chris Johns

Description: modified (diff)

What should happen with this ticket?

comment:11 Changed on 02/05/18 at 08:32:00 by Sebastian Huber

Milestone: 4.11.35.1

comment:12 Changed on 02/05/18 at 08:32:32 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: reopenedclosed

In 4ac5ffbb/rtems:

fsclose01: Add tmpfile() test case

Close #1971.

comment:13 Changed on 02/09/18 at 12:15:21 by Sebastian Huber <sebastian.huber@…>

In 48aa4b5d/rtems:

fsclose01: Use floating-point task

The tmpfile() uses sprintf().

Update #1971.

comment:14 Changed on 02/09/18 at 12:18:32 by Sebastian Huber <sebastian.huber@…>

In a3eec5c/rtems:

fsclose01: Fix task mode, use attribute

Update #1971.

comment:15 Changed on 02/12/18 at 00:07:17 by Chris Johns

The version and milestone for this ticket do not match.

Note: See TracTickets for help on using tickets.