Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. download file memory usage

download file memory usage

Scheduled Pinned Locked Moved C#
databasecomsysadminperformanceannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Planker
    wrote on last edited by
    #1

    I am writing a program that downloads a database on remote laptops, When downloading the file I noticed that my program uses about 15 MB of memory and calls Windows Explorer and WE uses about 16 MB of memory, the database file is about 60MB. I was wondering if there is something i am missing to reduce the amount of memory I am using. the laptops that will be using this app are older laptops and I want this process not to interfere with another database app that is very memory intensive. and once the download is complete it does not release the memory to a reasonable level any ideas. Thanks Rob FileStream fs = null; //' To access the local file; WebRequest req; //StreamReader sr; try { // This sets up the Request instance req = WebRequest.Create("http://www.domian.com/file.zip"); // Use a GET since no data is being sent to the web server req.Method = "GET"; // This causes the round-trip WebResponse rsp = req.GetResponse(); try { // Open the file to stream in the content fs = new FileStream("file.zip", FileMode.Create); // Copy the content from the response stream to the file. CopyData(rsp.GetResponseStream(), fs); }

    P 1 Reply Last reply
    0
    • P Planker

      I am writing a program that downloads a database on remote laptops, When downloading the file I noticed that my program uses about 15 MB of memory and calls Windows Explorer and WE uses about 16 MB of memory, the database file is about 60MB. I was wondering if there is something i am missing to reduce the amount of memory I am using. the laptops that will be using this app are older laptops and I want this process not to interfere with another database app that is very memory intensive. and once the download is complete it does not release the memory to a reasonable level any ideas. Thanks Rob FileStream fs = null; //' To access the local file; WebRequest req; //StreamReader sr; try { // This sets up the Request instance req = WebRequest.Create("http://www.domian.com/file.zip"); // Use a GET since no data is being sent to the web server req.Method = "GET"; // This causes the round-trip WebResponse rsp = req.GetResponse(); try { // Open the file to stream in the content fs = new FileStream("file.zip", FileMode.Create); // Copy the content from the response stream to the file. CopyData(rsp.GetResponseStream(), fs); }

      P Offline
      P Offline
      Phillip M Hoff
      wrote on last edited by
      #2

      How exactly are you copying the data from the response stream to the file stream? Another thing to consider is that looking at memory usage in the Task Manager (which is what I assume you are doing) can often be misleading. The allocated memory listed for a .NET-based application often includes memory which has been collected (i.e. released) as far as the application goes, but which simply hasn't been given back to the system by the runtime. However, that memory can be given back if and when the runtime believes the system needs it. If there are specific performance (memory or CPU) requirements for your application, then I would suggest using a profiler to help determine where the bottlenecks are in your application. -Phil

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups