public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: malloc segfaults Fixed
@ 2003-09-04 17:15 Juergen Bohn
  2003-09-05  7:14 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Juergen Bohn @ 2003-09-04 17:15 UTC (permalink / raw)
  To: cygwin

Thank you very much.  It works.

Only one remark: errno is still much earlier set to 12 (Not enough memory)
than x=malloc(10000) is NULL.  I don't know if this is of interest.

Is it possible to get your patch as snapshot for 1.3.22 too?

Thanks,
Juergen

> On Tue, Sep 02, 2003 at 03:35:04PM +0200, Juergen Bohn wrote:
>> Tested with cygwin1.dll 1.5.3-1 and 1.3.22-1 on Win2000-SP4, malloc() does 
>> not (always)
>> return NULL if there is no more memory available.  Try, for example, simple 
>> loops like:
>> 
>>   x = malloc(10000);
>>   for (i=0; x != NULL; i++)
>>   {
>>       x = malloc(10000);
>>       if (x == NULL)    printf("x is NULL\n");
>>   }
>> 
>> My application terminates with a segmentation violation, but all attempts 
> 
> I've applied a patch to cygwin which solves this problem.  You should
> get NULL at one point instead.
> 
>> to handle this by signal() or atexit() fail.  Unfortunately, also sysconf() 
>> does not work to get the number of available pages (_SC_AVPHYS_PAGES, I get 
>> always the same but wrong value).
> 
> I've changed sysconf to return a more accurate value for _SC_AVPHYS_PAGES.
> However, this is not a value you can rely on.  Cygwin processes might run
> out of memory even though there are still a lot of physical pages available.
> This is related to the fact that small allocations (less than 1 Meg) are
> taken from the applications heap which might be unraisable for some reason.
> 
> Corinna


<http://www.cygwin.com/ml/cygwin/2003-09/msg00268.html>





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: malloc segfaults Fixed
  2003-09-04 17:15 malloc segfaults Fixed Juergen Bohn
@ 2003-09-05  7:14 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2003-09-05  7:14 UTC (permalink / raw)
  To: cygwin

On Thu, Sep 04, 2003 at 07:15:23PM +0200, Juergen Bohn wrote:
> Is it possible to get your patch as snapshot for 1.3.22 too?

No, there will be no patches to 1.3.x anymore.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-05  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-04 17:15 malloc segfaults Fixed Juergen Bohn
2003-09-05  7:14 ` Corinna Vinschen

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).