Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7162019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:39:56+00:00 2026-05-28T13:39:56+00:00

I am trying to convert a 10,000 by 10,000 int array to double array

  • 0

I am trying to convert a 10,000 by 10,000 int array to double array with the following method (I found in this website)

public double[,] intarraytodoublearray( int[,] val){ 

        int rows= val.GetLength(0);
        int cols = val.GetLength(1);
        var ret = new double[rows,cols];
        for (int i = 0; i < rows; i++ )
        {

            for (int j = 0; j < cols; j++) 
            {
                ret[i,j] = (double)val[i,j];
            }
        }
        return ret;
}

and the way I call is

 int bound0 = myIntArray.GetUpperBound(0);
 int bound1 = myIntArray.GetUpperBound(1);
 double[,] myDoubleArray = new double[bound0,bound1];  
 myDoubleArray = intarraytodoublearray(myIntArray)  ;

it gives me this error,

Unhandled Exception: OutOfMemoryException
[ERROR] FATAL UNHANDLED EXCEPTION: System.OutOfMemoryException: Out of memory
at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_2 (intptr,intptr,intptr)

The machine has 32GB RAM, OS is MAC OS 10.6.8

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:39:56+00:00Added an answer on May 28, 2026 at 1:39 pm

    Well, you’re trying to create an array of 100 million doubles (each of which will take 800MB) – twice:

    // This line will allocate an array...
    double[,] myDoubleArray = new double[bound0,bound1];  
    // The method allocates *another* array...
    myDoubleArray = intarraytodoublearray(myIntArray);
    

    Why bother initializing myDoubleArray to an empty array and then reassigning the value? Just use:

    double[,] myDoubleArray = intarraytodoublearray(myIntArray);
    

    That will halve the amount of memory used for one thing. Now whether or not it’ll work at that point, I’m not sure… it depends on how Mono deals with large objects and memory. If you’re using a lot of memory, you definitely want to make sure you’re using a 64-bit VM. For example:

    gmcs -platform:x64 ...
    

    (The important assembly to compile with this option is the main application which will start up the VM. It’s not clear what kind of application you’re writing.)

    As an aside, intarraytodoublearray is a horrible name – it uses the alias int instead of the framework Int32 name, and it ignores the capitalization conventions. Int32ArrayToDoubleArray would be better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying convert the following Collatz Conjecture algorithm from: public class CollatzConjexture {
I am trying convert the following Collatz Conjecture algorithm from: public class CollatzConjexture {
I'm trying to convert a string into money format using this function , and
I am trying to format the contents of a text box: this.lblSearchResults1.Text = Convert.ToDouble(lblSearchResults1.Text).ToString();
How to extract and save array from string parameter? I'm trying convert string beafore_create
Trying to convert this: HDC hdc = CreateCompatibleDC(NULL); HBITMAP cross = (HBITMAP)LoadImage(NULL, _(c:\\captureqwsx.bmp) ,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
Trying to convert a string to NSURL and this is not happening. barcodeTextLabel.text =
Trying to convert this 0.274509817 to a nice precentage like 27% The string is
Hey, I am trying to convert NSString to a C string using cStringUsingEncoding but
I am trying to convert a string of the below format dd/MM/yyyy hh:mm:ss.fff into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.