From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,20b261795a1761e1 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-08-03 23:32:45 PST Path: archiver1.google.com!newsfeed.google.com!postnews1.google.com!not-for-mail From: banny52@yahoo.com (Ginny E. Kim) Newsgroups: comp.unix.tru64 Subject: Re: Kernel memory Date: 3 Aug 2001 23:32:45 -0700 Organization: http://groups.google.com/ Message-ID: <2f6bec0a.0108032232.74542b9d@posting.google.com> References: <2f6bec0a.0108020002.29080aa8@posting.google.com> <020820010901584492%harris@zk3.dec.com> <2f6bec0a.0108022055.24136296@posting.google.com> <3B6AAA99.4E07EB07@zk3.dec.com> NNTP-Posting-Host: 210.205.14.70 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 996906765 26968 127.0.0.1 (4 Aug 2001 06:32:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 4 Aug 2001 06:32:45 GMT Xref: archiver1.google.com comp.unix.tru64:4076 Brian Haley wrote in message news:<3B6AAA99.4E07EB07@zk3.dec.com>... > "Ginny E. Kim" wrote: > > > > X int statesize = 5737; > > > X static state_t **table = NULL; > > > X > > > X int table_init() > > > X { > > > X MALLOC(table, state_t **, sizeof(state_t *) * statesize, > > > X M_TEMP, M_NOWAIT); > > > X ...................... > > > X } > > > > > > MALLOC is used when the size of the storage can be specified as either > > > a hard coded constant, a #define contant, or a sizeof(...) constant. > > > > > > MALLOC_VAR is used when the size of the storage is passed as a > > > variable. 'statesize' is a variable and thus you should be using > > > MALLOC_VAR > > > > > > Bob Harris > > > > I used the size of the storage of MALLOC be specified as a hard coded constant. > > For instance, > > #define STATESIZE 5737 > > statesize = STATESIZE > > I don't think 'statesize' is a variable. > > MALLOC() in Tru64 V4.0F doesn't have this problem. > > Doesn't the type or flag of malloc() have the problem? > > Bob is absolutely right here, your code has a bug. 'statesize' is a global > variable, this means its value can be modified, for example with dbx. > For this reason, 'sizeof(state_t *) * statesize' cannot be calculated at > compile time, which is what's required if you're using MALLOC. > > You have had a lot of questions here lately, most of which can be > answered by reading the documentation. Please re-read some of it > again, you will probably notice a lot of things you didn't see the > first time now that you've had a chance to write some code. > > -Brian > > > --------------------------------------------------- > Brian P. Haley Brian.Haley@compaq.com > Tru64 UNIX Networking Group I used MALLOC_VAR(), but, I got same result such as MALLOC().... Is there any other solution like increasing kernel memory?