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 6863725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:49:18+00:00 2026-05-27T02:49:18+00:00

I’m working on a monte carol pricer and I need to improve the efficiency

  • 0

I’m working on a monte carol pricer and I need to improve the efficiency of the engine.

  • MonteCarlo path are created by a third party library (in c++)
  • Pricing is done in IronPython (script created by the end user)
  • Everything else is driven by a c# application

the pricing process is as follow:

  • C# application request the path and collect them
  • C# application push the paths to the script, who price and return the values
  • C# application display the result to the end user

The number and size of the paths collected are know in advance.

I have 2 solutions with some advantages and drawback:

  1. Request path generation, for each path, ask the script to return the result and finaaly aggregate the results once all paths are processed
  2. Request path generation, collect all of them, request the script to process all of them at once and retrun me the final price

The first solutions work fine in all scenarios but as the number of path requested increase the performance decrease (I think it’s due to the multiple call to ironpython)

The second solution is faster but can hit an “out of memory” exception (I think it’s not enough virtual memory addressing space) if the number of path requested is too large

I choose the middle ground and process a bunch of path then aggregate the prices.
What I want now is to increase the performance futher by knowing in advance how many path I can process withou hitting the “out of memory” exception

I did the math and I know in advance the size (in memory) of path for a given request. However because I’m quiet sure it’s not a memory problem but more virtual memory addressing issue


So all this text is summarize by the following 2 questions:

  1. Is it possible to know in advance how much virtual memory address my
    process wil need to store n instance of a class (size in memory and structure are known)?
  2. Is it possible to know how much virtual memory address are still available for my process

btw I’m working on the 32 bit computer

Thanks in advance for the help

  • 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-27T02:49:19+00:00Added an answer on May 27, 2026 at 2:49 am

    Finding out how much memory an object takes in .NET is a pretty difficult task. I’ve hit the same problem several times. There are some imperfect methods, but none are very precise.

    My suggestion is to get some estimate of how much a path will take, and then pass a bunch of them leaving a good margin of safety. Even if you’re processing them just 10 at a time, you’ve reduced the overhead 10 times already.

    You can even make the margin configurable and then tweak it until you strike a good balance. An even more elegant solution would be to run the whole thing in another process and if it hits an OutOfMemoryException, restart the calculation with less items (and adjust the margin accordingly). However, if you have so much data that it runs out of memory, then it might be a bit slow to pass it across two processes (which will also duplicate the data).

    Could it be that the memory overflow is because of some imperfections in the path processor? Memory leaks maybe? Those are possible both in C++ and .NET.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.