Results 1 to 4 of 4

Thread: Code to get memory used

  1. #1

    Thread Starter
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681

    Code to get memory used

    Anyone know code to get the currently used memory. I want to get the total memory used in a function, so I thought I would get the memory before the function executes, and then subtract this from the memory after the function is complete.

    Thanks!

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    As the GC wont release the resources immediately after you are done with them, the memory usage after your function is complete may not be accurate.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    I guess the best way would be through the task manager - and see what the peak memory usage is during execution of the function.

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    These properties of the Process class will help you but the results wont be what you need because of the GC.
    PagedMemorySize
    PagedSystemMemorySize
    PeakPagedMemorySize
    PeakVirtualMemorySize
    PeakWorkingSet
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

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