Re: Q: Unlock resources (How to?)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Severian (severian_at_chlamydia-is-not-a-flower.com)
Date: 02/16/05


Date: Wed, 16 Feb 2005 13:28:03 GMT

On Mon, 07 Feb 2005 12:29:44 -0500, johndoe1 <blam@blam.com> wrote:

>Friends,
>
>I wonder if you could enlighten me on this: it used to be possible to load
>a resource, lock it, use it, and then happily unload -- maybe repeating
>the procedure in a loop many times -- not holding in memory the stuff you
>no longer need in there. Now, I'm reading the docs and it says that
>UnlockResource is deprecated and "It is not necessary to unlock resources
>because the system automatically deletes them when the process that
>created them terminates". What kind of crap is that? I want to get rid of
>the stuff that I've used and am through with, and I'm going to load and
>use a lot or resources and they're not of a trivial size. And I'm not
>terminating right after their use, I've got a lot of other things to do.
>
>So, how do I get rid of loaded resources?
>
>Here's a scenario: say, I have 20 resources (custom, binary, not fonts or
>dialogs). I want to load them in sequence, one at a time, use them, and
>then go to the next one in a loop. But if I don't unload stuff and keep it
>all locked in memory, that seems like it's no good no? I suppose that a
>"loaded" resouce may be swapped out, but the "locked" can't, right? So I
>don't need them locked forever.
>
>Any suggestions?

As I understand it, resources are part of the mapped EXE (or DLL) and
will be paged out when not in use. Since they are read-only parts of
the executable, they do not consume page file space.

Locking them does not force them to remain in main memory.

--
Sev


Relevant Pages

  • RE: Net runtime crash
    ... > user controls and worked under massive requests load: ... > resources and updated all cache entries (we use server cache ... > debugging tools, some tools to get more descriptive event source ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Q: Unlock resources (How to?)
    ... >>use a lot or resources and they're not of a trivial size. ... I want to load them in sequence, one at a time, use them, and ... >>don't need them locked forever. ... > Locking them does not force them to remain in main memory. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: managed pool question
    ... You might get out-of-memory errors. ... > and I will load it all at once in loading time. ... > the amount of resources that will be loaded all at once is ...
    (microsoft.public.win32.programmer.directx.graphics)
  • loadstring fails in MBCS encoding
    ... Implementation of CString::LoadString has changed from VC6 to VC7 and I ... can't load MBCS resources correctly any more. ...
    (microsoft.public.vc.mfc)
  • Net runtime crash
    ... We developed ASP.Net application that run on production server, ... Failed to load resources from resource file ... debugging tools, some tools to get more descriptive event source ...
    (microsoft.public.dotnet.framework.aspnet)