cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getinmemory and a lot of page faults

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Fri, 30 May 2008 10:33:11 -0400

On Fri, May 30, 2008 at 5:51 AM, Michael Hecker <Hecker.Michael_at_gmx.de> wrote:
> Hello,
> the example getinmemory.c allocates new memory for every single call, which
> the task manager moves to the virtual memory in my case. I'm receiving a
> 500KB html file and I'm programming with MSVC.
> Since the task manager has to move the data back to the physical memory,
> when I want to work with it, the number of 'page faults' is rapidly growing.
>
> Is it possible to tell the task manager, that he shouldn't move the data to
> the virtual memory or ist it possible to use a single instance of 'struct
> MemoryStruct chunk' for several calls?

It's just sample code, change it in any way you want or don't use it
at all, to get any desired behaviour of your code. Just because it
uses MemoryStruct and expands it in that manner, doesn't mean your
code need to do that. Just make your program do what YOU want it to
do, with or without MemoryStruct (just swap in any suitable
placeholder for the data that you come up with). If you know you're
getting a 500KB file every single time, why don't you just allocate
that up front to begin with (expanding if necessary if you get more
than that), and keep track of the exact amount actually received (if
you get more or less amounts of data than you've initially allocated)?

Regarding page faults, I'm pretty sure you'd be better served asking
in a Windows-related forum or list.

Lars Nilsson
Received on 2008-05-30