🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #7193

Re: Any problems with malloc on OS 4.1?

#7193
From: Dale Gallaher
Date: Sun, 24 Mar 1991 12:32
43 lines
2775 bytes
I got a slew of replies on this problem so I thought it would be helpful
if I brought people up-to-date on what I know.  There were many possible
causes of the problem that were proposed from overwrites in the
application code to known Sun bugs with patches for 4.1 and fixed in
4.1.1.  Thanks to all who replied.

First of all the problem does exist in O.S. 4.1.1 also so it is not fixed
there.  If anything it seems to be a little more frequent in O.S. 4.1.1.
As far as overwrites in the application code I think it is rather unlikely
since the code works fine on O.S. 4.0.3 or earlier and runs fine on all
other platforms.  Of course, it is always possible it is just some
overwrite the new Sun malloc is sensitive to.

The most likely problem is very clearly stated in the Sun sbrk man page,
and I quote

"WARNINGS
     Programs combining the brk() and  sbrk()  system  calls  and
     malloc()  will not work.  Many library routines use malloc()
     internally, so use brk() and sbrk() only when you know  that
     malloc() definitely will not be used by any library routine."

Since our application makes heavy use of both malloc and sbrk and the man
page claims programs doing this "WILL NOT WORK",  it seems that this is
very likely to be the problem.  Also, since the crash is always in putenv
which is a library routine which calls malloc, it is even more likely that
this is the problem.

A bigger problem for me is what to do now.  I have temporarily worked
around the problem by using my own version of malloc.  Unfortunately,
maintaining our own malloc could be a problem with future Sun releases for
different reasons. The use of sbrk is essential to the performance of the
application due to its memory management algorithms.  It seems I am kind
of stuck with my own malloc for now.

The main thing I don't understand is how Sun can make two such basic
functions in Unix incompatible within the same program.  I would really
like to hear someone give a good explanation as to why this wasn't a
ridiculous restriction to create.

Dale Gallaher					Cognition Corp.
dale@dandelion.ci.com				
(508)667-7900 x121				Billerica, MA
Technical Details
Message-ID: <2122@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: dale@dandelion.ci.com (Dale Gallaher)
Newsgroups: comp.sys.sun
Subject: Re: Any problems with malloc on OS 4.1?
Keywords: SunOS
Message-ID: <2122@brchh104.bnr.ca>
Date: 24 Mar 91 12:32:00 GMT
Sender: news@brchh104.bnr.ca
Organization: Sun-Spots
Lines: 43
Approved: Sun-Spots@rice.edu
X-Original-Date: 21 Mar 91 14:28:32 GMT
X-Refs:  Original: v10n54
X-Sun-Spots-Digest: Volume 10, Issue 61, message 8
X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu