Results 1 to 4 of 4

Thread: maximum array size

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    83

    maximum array size

    hey guys
    i was experimenting with writing some simple encryption program with help and advice from randem!!

    anyway what the prog does is read in a file into a byte array
    so that for a file of 10 bytes the array has 10 entries

    so just there i tried to encrypt a film on my computer and got
    runtime error 7 out of memory
    when i clicked debug the array which was to contain all the bytes showed up yellow

    so i did a quick serach to see how big an array can be
    and came across (2^31)-1 which is just over 2 billion.

    but my film was only 1gb which is 1 billion bytes which should fit within an array with a capacity of over 2 billion entries?

    its not an issue with my system ram as i have 2gb of ram?

    anyway i would be interested to hear any insights on this.
    i have a feeling that i could rewrite it so that the array only loads in 100mb at a time, does its work, then loads in the next 100mb etc etc etc. i suppose that approach would be better! in case i want to encrypt a 10gb file!!

    let me know what you know!! cheers-jim

  2. #2
    Fanatic Member Mxjerrett's Avatar
    Join Date
    Apr 2006
    Location
    Oklahoma
    Posts
    939

    Re: maximum array size

    It sounds like it is running an infinite loop or something. If the array was out of memory it would say overflow. Try debuging to see where it is snagging.

    If a post has been helpful please rate it.
    If your question has been answered, pull down the tread tools and mark it as resolved.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    83

    Re: maximum array size

    i dont think its an infinite loop, it works fine for smaller files, i've just tested a zip archie which is 150mb, i'm pretty sure that the array has run out of space, just wondering if anyone else had experienced it!

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: maximum array size

    You would need to read the file into smaller chunks to process and loop thru the file until all chunks are done. Then it would process all size files.

Posting Permissions

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



Click Here to Expand Forum to Full Width