Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] memory

From: Daniel Kalchev <daniel(at)digsys(dot)bg>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-ports <pgsql-ports(at)postgresql(dot)org>
Subject: Re: [GENERAL] memory
Date: 1999-12-06 08:34:40
Message-ID: 199912060834.KAA07199@dcave.digsys.bg (view raw or flat)
Thread:
Lists: pgsql-ports
Bruce,

As suggested, I wrote the following program (test.c):

--- cut here ---
#include <stdlib.h>

main()
{
    int allocated = 0;
    int mb = 1024 * 1024;

    while (malloc(mb) != NULL) {
        allocated ++;
        printf ("%d MB allocated\n", allocated);
    }
}
--- cut here ---

$ limits
coredumpsize    unlimited
cputime         unlimited
datasize        131072 kbytes
filesize        unlimited
maxproc         256
memorylocked    85380 kbytes
memoryuse       256136 kbytes
openfiles       128
stacksize       2048 kbytes

$ make test
cc -O2 test.c -o test
$ ./test
1 MB allocated
2 MB allocated
3 MB allocated
4 MB allocated
5 MB allocated
6 MB allocated
7 MB allocated
8 MB allocated
9 MB allocated
10 MB allocated
11 MB allocated
12 MB allocated
13 MB allocated
14 MB allocated
15 MB allocated
16 MB allocated
17 MB allocated
18 MB allocated
19 MB allocated
20 MB allocated
21 MB allocated
22 MB allocated
23 MB allocated
24 MB allocated
25 MB allocated
26 MB allocated
27 MB allocated
28 MB allocated
29 MB allocated
30 MB allocated
31 MB allocated
32 MB allocated
33 MB allocated
34 MB allocated
35 MB allocated
36 MB allocated
37 MB allocated
38 MB allocated
39 MB allocated
40 MB allocated
41 MB allocated
42 MB allocated
43 MB allocated
44 MB allocated
45 MB allocated
46 MB allocated
47 MB allocated
48 MB allocated
49 MB allocated
50 MB allocated
51 MB allocated
52 MB allocated
53 MB allocated
54 MB allocated
55 MB allocated
56 MB allocated
57 MB allocated
58 MB allocated
59 MB allocated
60 MB allocated
61 MB allocated
62 MB allocated
63 MB allocated
64 MB allocated
65 MB allocated
66 MB allocated
67 MB allocated
68 MB allocated
69 MB allocated
70 MB allocated
71 MB allocated
72 MB allocated
73 MB allocated
74 MB allocated
75 MB allocated
76 MB allocated
77 MB allocated
78 MB allocated
79 MB allocated
80 MB allocated
81 MB allocated
82 MB allocated
83 MB allocated
84 MB allocated
85 MB allocated
86 MB allocated
87 MB allocated
88 MB allocated
89 MB allocated
90 MB allocated
91 MB allocated
92 MB allocated
93 MB allocated
94 MB allocated
95 MB allocated
96 MB allocated
97 MB allocated
98 MB allocated
99 MB allocated
100 MB allocated
101 MB allocated
102 MB allocated
103 MB allocated
104 MB allocated
105 MB allocated
106 MB allocated
107 MB allocated
108 MB allocated
109 MB allocated
110 MB allocated
111 MB allocated
112 MB allocated
113 MB allocated
114 MB allocated
115 MB allocated
116 MB allocated
117 MB allocated
118 MB allocated
119 MB allocated
120 MB allocated
121 MB allocated
122 MB allocated
123 MB allocated
124 MB allocated
125 MB allocated
126 MB allocated
127 MB allocated

$ unlimit
$ limit
coredumpsize    unlimited
cputime         unlimited
datasize        262144 kbytes
filesize        unlimited
maxproc         4116
memorylocked    256140 kbytes
memoryuse       256136 kbytes
openfiles       13196
stacksize       262144 kbytes
$ ./test
[...]
250 MB allocated
251 MB allocated
252 MB allocated
253 MB allocated
254 MB allocated

I guess this says malloc on BSD/OS works as expected (I will be extremely 
surprised if it does not).

Daniel

>>>Bruce Momjian said:
 > > > I have run BSDI for years and never saw this problem.  Not sure on a
 > > > cause, though.
 > > 
 > > Bruce,
 > > 
 > > I too run BSD/OS for years and on all BSD/OS versions since 2.1 and Postgr
     es 
 > > since 6.0 (earlier postrges releases didn't have much load here) observe t
     he 
 > > same problem:
 > 
 > [Redirected to ports list].
 > 
 > OK, let me suggest something.  Just write a program and see how much
 > memory you can malloc().  THe sbrk call is for heap memory, so see how
 > many 1mb chunks you can malloc before it fails.
 > 
 > The error sbrk() is not related to shared memory or semaphores.  THe
 > 6.5.* code gets all shared memory and semaphores on startup, so if it
 > starts, it has done all that already.
 > 
 > -- 
 >   Bruce Momjian                        |  http://www.op.net/~candle
 >   maillist(at)candle(dot)pha(dot)pa(dot)us            |  (610) 853-3000
 >   +  If your life is a hard drive,     |  830 Blythe Avenue
 >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



Responses

pgsql-ports by date

Next:From: hongwei wuDate: 1999-12-06 10:44:29
Subject: from a user
Previous:From: Adam WalczykiewiczDate: 1999-12-06 06:46:34
Subject: Red Hat'sRPMS version an Suse Linux 6.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group