5 Replies - 466 Views - Last Post: 28 March 2012 - 07:25 PM Rate Topic: -----

#1 kraz0r12  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 27-March 12

Determining memory usage for calculating pi

Posted 27 March 2012 - 07:27 PM

Hey guys,
I have just finished writing a program that calculates pi for as many digits as the user specifies. One thing I'm trying to do now is measure how much memory the calculation consumes. When I read articles about people that have calculated pi to several trillion digits, they usually mention that a few terabytes of memory were needed. How would I measure memory consumption with Python? Is this even possible? Thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: Determining memory usage for calculating pi

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 734
  • View blog
  • Posts: 1,890
  • Joined: 23-December 08

Re: Determining memory usage for calculating pi

Posted 27 March 2012 - 09:42 PM

you got me! that's a good question.

EDIT:
Renamed your topic to reflect your actual question.

This post has been edited by atraub: 28 March 2012 - 08:54 AM

Was This Post Helpful? 0
  • +
  • -

#3 DimitriV  Icon User is offline

  • Don't try to save yourself… the circle is complete
  • member icon

Reputation: 544
  • View blog
  • Posts: 2,632
  • Joined: 24-July 11

Re: Determining memory usage for calculating pi

Posted 27 March 2012 - 09:55 PM

This may be of assistance:
http://pysizer.8325.org/
Was This Post Helpful? 0
  • +
  • -

#4 Motoma  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 450
  • View blog
  • Posts: 795
  • Joined: 08-June 10

Re: Determining memory usage for calculating pi

Posted 28 March 2012 - 05:53 AM

You can also use sys.getsizeof() to find the amount of memory used by a particular object, which may or may not be useful to you, depending on how you wrote your code.
Was This Post Helpful? 1
  • +
  • -

#5 kraz0r12  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 27-March 12

Re: Determining memory usage for calculating pi

Posted 28 March 2012 - 06:00 AM

Hey thanks Motoma, thats exactly what I ended up doing!
Was This Post Helpful? 1
  • +
  • -

#6 raspinudo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 33
  • View blog
  • Posts: 148
  • Joined: 19-September 11

Re: Determining memory usage for calculating pi

Posted 28 March 2012 - 07:25 PM

View PostMotoma, on 28 March 2012 - 05:53 AM, said:

You can also use sys.getsizeof() to find the amount of memory used by a particular object, which may or may not be useful to you, depending on how you wrote your code.


This would be in bytes, correct?
Edit, my lazy behind followed the link and found it ^_^

This post has been edited by raspinudo: 28 March 2012 - 07:33 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1