Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com X-Injected-Via-Gmane: http://gmane.org/ Path: not-for-mail From: "Hans Horn" Subject: Re: limit for # of items created with "new" ? Date: Tue, 24 Sep 2002 18:00:21 -0700 Lines: 131 Message-ID: References: NNTP-Posting-Host: p1.almaden.ibm.com X-Trace: main.gmane.org 1032915365 355 198.4.83.52 (25 Sep 2002 00:56:05 GMT) X-Complaints-To: usenet AT main DOT gmane DOT org NNTP-Posting-Date: Wed, 25 Sep 2002 00:56:05 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Igor, "Igor Pechtchanski" wrote in message news:Pine DOT GSO DOT 4 DOT 44 DOT 0209241841560 DOT 7805-100000 AT slinky DOT cs DOT nyu DOT edu... > Don't forget the object headers - depending on which options you use, they > can be 8 bytes per object. It would really help to see the source of the > crashing program, at least the snippet with the allocation and dereferencing. Are there options that cost less (in terms of object headers) that the defaults? Allrighty, here's the essence of what's going on: // compiled with : gcc -O2 tst.cpp -o tst -lstdc++ // gcc version: 3.2 #define NUM_POINTS 85000 #define NON_ZERO 30 // problem: have a collection of NUM_POINTS points, // - each point has attached ca 2800 byte descriptive info // - each point has two kinds (left and right) of neighbors. // actual neighborhood of all points is given by a very sparse NUM_POINTS * NUM_POINTS matrix, // having on average only NON_ZERO non-zero elements per row/column. #include #include #include // an element of a linked list typedef struct node { node (int _v, node* _n) : v(_v), next(_n) {} int v; node* next; }; int main (int argc, char** argv) { // allocate descriptions of points char** points = new char*[NUM_POINTS]; assert(points); for (int i = 0; i < NUM_POINTS; i++) { points[i] = new char[2800]; assert(points[i]); } cout << "inited points[]" << endl; // represent neighborhood for each point via linked lists : node** adjl = new node*[NUM_POINTS]; assert(adjl); // neighbors to the left node** adjr = new node*[NUM_POINTS]; assert(adjr); // neighbors to the right for (int i = 0; i < NUM_POINTS; i++) { adjl[i] = adjr[i] = NULL; } for (int i = 0; i < NUM_POINTS; i++) { for (int j = 0; j < NON_ZERO; j++) { adjl[i] = new node(j, adjl[i]); assert(adjl[i]); adjr[i] = new node(j, adjr[i]); assert(adjr[i]); } cout << "i " << i << ": total " << (i+1) * 2 * NON_ZERO << endl; // last output: "i 29950: total 1797060" } cout << "inited adjl,r[]" << endl; // process points[] and adjl,r[] // clean-up return 0; } Hans > > On Tue, 24 Sep 2002, Hans Horn wrote: > > > Ooops, > > > > I just realized that the number of objects I've allocated is about > > 1,600,000, NOT 160,000! > > But still, each object (nodes of a singly linked list) weighs only 8 byte. > > > > H. > > > > "Hans Horn" wrote in message news:amq618$9kr$1 AT main DOT gmane DOT org... > > > List, > > > > > > I am experiencing a problem when I need to allocate a large number of > > > small objects with new. (cygwin 1.3.12.4, gcc 3.2). Up to about 160 > > > 000 objects I'm doing fine, but above the process receives a sigterm > > > and croaks. > > > > > > On occasion, even the entire bash shell becomes corrupt and needs to > > > be shut down. When this happens, the bash shell complains : > > > > > > *** mount version mismatch detected - 0xA820/0x1B. > > > You have multiple copies of cygwin1.dll on your system. > > > Search for cygwin1.dll using the Windows Start->Find/Search facility > > > and delete all but the most recent version. The most recent version > > > *should* reside in x:\cygwin\bin, where 'x' is the drive on which you > > > have installed the cygwin distribution. > > > > > > Is there a maximum numbers of "new-allocatable" objects? If yes, is > > > this number configurable? > > > > > > thx a lot, > > > Hans > > > > > > P.s. Btw, I'm running Win2k with 512 MByte memory. When I watch the > > > process die in task manager, the total memory load is at about 450 > > > MByte. > > -- > http://cs.nyu.edu/~pechtcha/ > |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu > ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com > |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski > '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! > > "Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51 > > > -- > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > Bug reporting: http://cygwin.com/bugs.html > Documentation: http://cygwin.com/docs.html > FAQ: http://cygwin.com/faq/ > > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/