Ask a Question related to Sun Solaris, Design and Development.

  1. #1

    Default array in C program

    How do I determine what the maximum of array I can use in C program?

    I have Sun Solaris. How many array I can declare, I know it depends on
    memory.

    If I have set line[100000] in my C program, how many memory do I need?






    Thanks


    cljlk Guest

  2. Similar Questions and Discussions

    1. PDF and program won't open; "Error in Acrord32" "This program has performed an illegal operation and
      I recently had a browser hijacker. Fixed it with Norton and Lavasoft. Now, after downloading new Reader 6.0, I can't open anything. Only gives...
    2. [newbie]saving and reading array of associative array
      i'm looking for examples of saving to file and reading back an array of associative array, in a ruby like way. saying i have something like : ...
    3. array data matches but array created in loop doesn't work
      I have the exact same data in two arrays, but only the array created like so will work: $spaw_imglibs = array( array( 'value' =>...
    4. #24897 [Com]: array_multisort() will reindex the array but not if array length is 1
      ID: 24897 Comment by: franklin_se at hotmail dot com Reported By: chro at sokrates dot uio dot no Status: ...
    5. #24897 [Opn->Asn]: array_multisort() will reindex the array but not if array length is 1
      ID: 24897 Updated by: sniper@php.net Reported By: chro at sokrates dot uio dot no -Status: Open +Status: ...
  3. #2

    Default Re: array in C program

    "cljlk" <cljlk@hotmail.com> writes in comp.unix.solaris:
    |How do I determine what the maximum of array I can use in C program?
    |I have Sun Solaris. How many array I can declare, I know it depends on
    |memory.

    You divide the maximum memory your program can allocate by the size
    of the array members.

    The maximum memory your program can allocate is the smallest number on
    this list:
    - the total amount of virtual memory (RAM + swap) free at runtime,
    minus whatever overhead your program needs to load itself and
    set up it's stack (see the "available" number in 'swap -s')
    - Approx. 3.9GB if running a 32-bit process on a recent Solaris
    - the value of ulimit -d if it's not set to 'unlimited'


    |If I have set line[100000] in my C program, how many memory do I need?

    100000 times the size of whatever datatype that variable is.
    If it's a char, 100000 bytes. If it's an int, 400000 bytes.

    --
    __________________________________________________ ______________________
    Alan Coopersmith [email]alanc@alum.calberkeley.org[/email]
    [url]http://www.CSUA.Berkeley.EDU/~alanc/[/url] aka: [email]Alan.Coopersmith@Sun.COM[/email]
    Working for, but definitely not speaking for, Sun Microsystems, Inc.
    Alan Coopersmith Guest

  4. #3

    Default Re: array in C program

    Alan Coopersmith wrote:
    > "cljlk" <cljlk@hotmail.com> writes in comp.unix.solaris:
    > |How do I determine what the maximum of array I can use in C program?
    > |I have Sun Solaris. How many array I can declare, I know it depends on
    > |memory.
    >
    > You divide the maximum memory your program can allocate by the size
    > of the array members.
    Actually it depends if the array is a local variable (on the stack)
    or a global variable (on the heap). You program has a fixed size
    stack (than can be adjusted with some ELF/ld tweaks), but the heap
    can grow to the max ram size allowed for a process on your system.

    -Wayne

    Wayne Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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