Results 1 to 6 of 6

Thread: Size of Arrays

  1. #1


    Member Since
    Jan 28, 2012
    Posts
    24
    Question Size of Arrays
    I have 4 gigabits of memory but in Xcode the largest array I have been able to assign is [25000][81]. I am working with Sudoku puzzles. That does not fill my memory how do I set larger arrays? Help please.
    Warren Trammell

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Moved thread to more appropriate forum.

    I'm not a professional programmer (nor do I even like ObjC) but what kind of array are you trying to create? Some sample code would also help.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3


    Member Since
    Jan 28, 2012
    Posts
    24
    Allowable array size
    I am trying to read into memory a large group of Sudoku puzzles by declaring an int array[x][81] where x is 49151 but the largest Xcode will allow is something under 25000.
    Warren

  4. #4

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,782
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Have you tried using NSArray instead?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5


    Member Since
    Jan 28, 2012
    Posts
    24
    #include <iostream>

    FILE *reed;

    int main(int argc, const char * argv[])
    {
    int a, b, array[25879][81];

    if((reed = fopen("//Users//warren//documents//misc//sudoku17","r")) == NULL)
    {
    printf("\n Can't open input file for reading:");
    exit(1);
    } // insert code here...
    for(a = 0; a < 25000; a++)
    {
    for(b = 0; b < 81; b++)
    {
    fscanf(reed,"%i",&array[a][b]);
    }
    }
    return 0;
    }
    That is the largest array Xcode will accept.It balks at 25880.
    Changing the name of the variable probably will not help.
    Warren

  6. #6

    cptkrf's Avatar
    Member Since
    Dec 09, 2009
    Location
    The same as Sheldon Cooper - East Texas
    Posts
    453
    Specs:
    iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
    IMO you are taking the long way around. Instead of trying to use an array with humongous indexes, why not just use a lightweight database like SQLITE and dump your puzzles into that? It looks like you are trying to do exactly one of the things that a DB is good for. For one thing, you wouldn't have to load that huge array every time you ran the program - it would just be setting there on disk waiting to be used.

    If you've mastered Xcode, sqlite3 would be nothing to learn. Or even the open source version of MySql.

    Just an idea.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. hd size
    By jga in forum Switcher Hangout
    Replies: 1
    Last Post: 12-24-2012, 02:54 PM
  2. HD size
    By jott in forum Switcher Hangout
    Replies: 8
    Last Post: 04-10-2012, 12:11 AM
  3. Apps' size on iTunes and size on iPhone 4s varies?
    By thechadmartinez in forum iOS and Apps
    Replies: 1
    Last Post: 11-25-2011, 08:21 PM
  4. VM size: 42 GB
    By agropadus in forum OS X - Operating System
    Replies: 0
    Last Post: 01-18-2008, 08:59 AM
  5. file size vs media size difference after jpg conversion
    By nick_harambee in forum Images, Graphic Design, and Digital Photography
    Replies: 0
    Last Post: 09-22-2007, 09:33 PM

Posting Permissions

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