Thread View: comp.std.c
4 messages
4 total messages
Started by Brian Gregory
Mon, 18 Mar 1996 19:48
BoundsChecker and fgets fmalloc problems
Author: Brian Gregory
Date: Mon, 18 Mar 1996 19:48
Date: Mon, 18 Mar 1996 19:48
23 lines
1099 bytes
1099 bytes
I am using Bounds Checker v2.5, and am having a problem finding a memory leak it is reporting... Example: fgets( szBuf, 799, fpIn ); szBuf is an 800 character buffer (pre-sized array) fpIn IS a valid pointer no memory is corrupt before the fgets line The application is a windows app, written in straight C with a large memory model. The problem is Boundschecker consistently reports memory leaks for the larger buffer size mallocs contained WITHIN the fgets function... Any help on resolving this recurrent problem, or just an indication that this is perhaps an erroneous error reported by Boundschecker would be greatly appreciated. Thanks, Brian Gregory bri@primenet.com
Re: BoundsChecker and fgets fmalloc problems
Author: Stephen Baynes
Date: Tue, 19 Mar 1996 08:45
Date: Tue, 19 Mar 1996 08:45
37 lines
1871 bytes
1871 bytes
Brian Gregory (bri@primenet.com) wrote: : I am using Bounds Checker v2.5, and am having a problem finding a : memory leak it is reporting... : Example: : fgets( szBuf, 799, fpIn ); : szBuf is an 800 character buffer (pre-sized array) : fpIn IS a valid pointer : no memory is corrupt before the fgets line : The application is a windows app, written in straight C with a large : memory model. : The problem is Boundschecker consistently reports memory leaks for the : larger buffer size mallocs contained WITHIN the fgets function... I don't think that the ANSI standard makes any requirement on library functions that they should not leak memory. (Can anyone construct a requirement from any execution limit?). So as far as the standard is concerened there is nothing wrong with your fgets. : Any help on resolving this recurrent problem, or just an indication : that this is perhaps an erroneous error reported by Boundschecker : would be greatly appreciated. Quality of implementation issues of specific implementations are outside the scope of this newsgroup. I suggest you take it up with your supplier or in the newsgroup for your platform. -- Stephen Baynes baynes@ukpsshp1.serigate.philips.nl Philips Semiconductors Ltd Southampton My views are my own. United Kingdom
Re: BoundsChecker and fgets fmalloc problems
Author: James Kanze US/ESC 60/3/141 #407...
Date: Tue, 19 Mar 1996 10:04
Date: Tue, 19 Mar 1996 10:04
32 lines
1804 bytes
1804 bytes
In article <4ikelh$gji@nnrp1.news.primenet.com> bri@primenet.com (Brian
Gregory) writes:
|> I am using Bounds Checker v2.5, and am having a problem finding a
|> memory leak it is reporting...
|> Example:
|> fgets( szBuf, 799, fpIn );
|> szBuf is an 800 character buffer (pre-sized array)
|> fpIn IS a valid pointer
|> no memory is corrupt before the fgets line
|> The application is a windows app, written in straight C with a large
|> memory model.
|> The problem is Boundschecker consistently reports memory leaks for the
|> larger buffer size mallocs contained WITHIN the fgets function...
Is fpIn ever closed? (If it is stdin, it normally won't be.) Most
implementations of stdio will allocate a large buffer (for buffering
purposes) on the first IO to the file, and free it when the file is
closed. If the file is never closed...
All of the memory checkers I'm familiar with (Purify and my own) have
the possibility to state that certain `leaks' are normal, and shouldn't
be mentioned.
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
Re: BoundsChecker and fgets fmalloc problems
Author: James Kanze US/ESC 60/3/141 #407...
Date: Tue, 19 Mar 1996 10:04
Date: Tue, 19 Mar 1996 10:04
32 lines
1803 bytes
1803 bytes
In article <4ikelh$gji@nnrp1.news.primenet.com> bri@primenet.com (Brian
Gregory) writes:
|> I am using Bounds Checker v2.5, and am having a problem finding a
|> memory leak it is reporting...
|> Example:
|> fgets( szBuf, 799, fpIn );
|> szBuf is an 800 character buffer (pre-sized array)
|> fpIn IS a valid pointer
|> no memory is corrupt before the fgets line
|> The application is a windows app, written in straight C with a large
|> memory model.
|> The problem is Boundschecker consistently reports memory leaks for the
|> larger buffer size mallocs contained WITHIN the fgets function...
Is fpIn ever closed? (If it is stdin, it normally won't be.) Most
implementations of stdio will allocate a large buffer (for buffering
purposes) on the first IO to the file, and free it when the file is
closed. If the file is never closed...
All of the memory checkers I'm familiar with (Purify and my own) have
the possibility to state that certain `leaks' are normal, and shouldn't
be reported.
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads