#1971 closed defect (fixed)

Memory leak in tmpfile()

Reported by: nopscmn 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 nopscmn on Nov 24, 2011 at 1:50:41 PM.
Test application

Download all attachments as: .zip

Change History (16)

Changed on Nov 24, 2011 at 1:50:41 PM by nopscmn

Attachment: init.c added

Test application

comment:1 Changed on Apr 11, 2014 at 7:33:28 PM by Gedare Bloom

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

comment:2 Changed on Apr 14, 2014 at 6:02:01 AM by Sebastian Huber

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

comment:3 Changed on Apr 14, 2014 at 3:37:59 PM by Joel Sherrill

Cc: Joel Sherrill added

comment:4 Changed on Apr 16, 2014 at 5:21:26 AM by nopscmn

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 Nov 20, 2014 at 3:27:43 AM by Chris Johns

Description: modified (diff)
Milestone: 4.124.11

comment:6 Changed on Dec 19, 2014 at 4:38:14 AM 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 Jan 26, 2017 at 7:16:00 AM by Sebastian Huber

Milestone: 4.11.14.11.2

comment:8 Changed on Mar 23, 2017 at 1:03:28 AM by Chris Johns

Milestone: 4.11.24.11.3

The 4.11.2 milestone is closing.

comment:9 Changed on Mar 23, 2017 at 1:05:42 AM by Chris Johns

Version: 4.104.11

Move to the 4.11 branch.

comment:10 Changed on Feb 5, 2018 at 5:56:05 AM by Chris Johns

Description: modified (diff)

What should happen with this ticket?

comment:11 Changed on Feb 5, 2018 at 8:32:00 AM by Sebastian Huber

Milestone: 4.11.35.1

comment:12 Changed on Feb 5, 2018 at 8:32:32 AM by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: reopenedclosed

In 4ac5ffbb/rtems:

fsclose01: Add tmpfile() test case

Close #1971.

comment:13 Changed on Feb 9, 2018 at 12:15:21 PM by Sebastian Huber <sebastian.huber@…>

In 48aa4b5d/rtems:

fsclose01: Use floating-point task

The tmpfile() uses sprintf().

Update #1971.

comment:14 Changed on Feb 9, 2018 at 12:18:32 PM by Sebastian Huber <sebastian.huber@…>

In a3eec5c/rtems:

fsclose01: Fix task mode, use attribute

Update #1971.

comment:15 Changed on Feb 12, 2018 at 12:07:17 AM by Chris Johns

The version and milestone for this ticket do not match.

Note: See TracTickets for help on using tickets.