Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Sep 22 20:21:59 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8N3LxDL002900 for ; Mon, 22 Sep 2008 20:21:59 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8N3OUpj029162 for ; Mon, 22 Sep 2008 20:24:30 -0700 Message-Id: <200809230324.m8N3OUpj029162@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: About book keeping time Date: Mon, 22 Sep 2008 20:24:30 -0700 From: Bill Cheng Someone wrote: > To store the interarrival times and departure times for each customer, i > dynamically allocate memory (using realloc) for an array of size (number of > customers*sizeof(float)) but this allocation fails when i use a very large > value of 'n' as in the following test case > ./mm2 -seed 1 -n 1000000000 -size 1000000000 -d det > > What shud i do in this case, exit saying tht memory allocation failed or is > there some other way out ? If you want to do it right, you should fix your code and call realloc() only when you need it. Pre-allocating memory for all customers is a bad way to go! If there is no time to fix you code, you should just accept that you did it wrong and lose those 10 points! -- Bill Cheng // bill.cheng@usc.edu