🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #47

Problem with malloc, heap space, unix and scientific C with dynamic allocation

#47
From: Ira Ekhaus
Date: Sat, 31 Oct 1992 20:03
38 lines
2045 bytes
Hello,

I'm doing some scientific programming where the emphasis has been
on the algorithm development and  not on elegant, efficient use of memory. 

Unfortunately my particular configuration of machine/UNIX 
SparcII/SunOS Release 4.1.2 (GENERIC) 
seems to cough when my total memory requests exceed ~ 500 K .
which seems ridiculous for a system with 32M of ram (see vmstat below ):
I should mention there are several other users who like to use matlab and hog
a bunch of memory.
     unix% vmstat
     procs     memory              page               disk       faults     cpu
     r b w   avm   fre  re at  pi  po  fr  de  sr d0 s1 s2 s3  in  sy  cs us sy id
     1 0 0     0 24356   0  1   1   0   0   0   0  0  0  0  0  12  23   8  1  2 97



Currently, the approach I'm rewriting my own stuff to do goes as follows:
	1) right at the start of my program I allocate a pointer with a few Mbytes. 
	2) Use my own alloc routine that just equates the pointer to a spot within 
	the memory of 1) and keep track of what I've reserved.
The disadvantage is that as far as the system is concerned, I've only allocated one big block.
So, I have no means of freeing a specific spot of memory without clearing out everything,

What combination of system configuration and malloc routines will robustly grab a few 
Mbytes for my application and KEEP it?
I'd like the OS to keep track of the heap  it possible.

thanks,

Ira
ekhaus@draper.com
Phone: 617 258 1109
Draper Laboratories m.s. 7c
555 Technology Square
Cambridge , MA 
02139
Technical Details
Message-ID: <IBE1109.92Oct31150355@etbsun1.draper.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!ns.draper.com!news.draper.com!surname!ibe1109

Show Full Headers
Complete Article Headers
Newsgroups: sci.math.num-analysis
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!ns.draper.com!news.draper.com!surname!ibe1109
From: ibe1109@draper.com (Ira Ekhaus)
Subject: Problem with malloc, heap space, unix  and scientific C with  dynamic allocation
Message-ID: <IBE1109.92Oct31150355@etbsun1.draper.com>
Sender: nntp@draper.com (NNTP Master)
Nntp-Posting-Host: etbsun1.draper.com
Organization: Draper Laboratory, Inc., Cambridge, MA
Date: Sat, 31 Oct 1992 20:03:55 GMT
Lines: 38