|
Prev: API to get the left mouse state (pressed or not) ?
Next: communication between C# dll and C++ dll ???
From: Sha on 7 May 2008 03:39 Hi pals, I would like to limit my process from being loaded with data more than 1.5 GB. To do that, am considering Virtual bytes in PerfMon tool. Is it right way? But in Task manager, VM size is equivalent to the Private Bytes in PerfMon tool. Got confused by seeing this. Could you please tell me the difference between private bytes and virtual bytes? and which one suits for my requirement? Regards, Sha.
From: Joseph M. Newcomer on 7 May 2008 11:31
Most of the number you get from these tools are not reliable. For example, if you have 1.5GB of address space, you have no idea how much of that is unallocated and how much is allocated. You have to understand how storage allocation works to understand that the number could be completely meaningless, because, while you might have 1.5GB of address space in use, 1.2GB of that might actually be available to hold data. You are worrying about the wrong problem. You do not manage address space by using any of the numbers you have observed. You manage address space by controlling the paths that allocate data. When data is allocated, your space-in-use account is debited; when you free memory, your account is credited. The ONLY criterion for whether or not you can load more data is this "account" you maintain on your own. See my essay on how storage management works on my MVP Tips site. Note also the _CrtMemCheckpoint library function is complete nonsense in terms of how it reports the amount of memory allocated. Therefore, you can either track the allocation at the point of allocation (very cheap), or you can (very expensively) walk the heap. Since you are concerned only with one particular type of data, you should throttle its allocation, and not worry about other allocations. joe On Wed, 7 May 2008 13:09:51 +0530, "Sha" <shahulalways(a)hotmail.com> wrote: >Hi pals, > >I would like to limit my process from being loaded with data more than 1.5 >GB. >To do that, am considering Virtual bytes in PerfMon tool. Is it right way? >But in Task manager, VM size is equivalent to the Private Bytes in PerfMon >tool. Got confused by seeing this. > >Could you please tell me the difference between private bytes and virtual >bytes? and which one suits for my requirement? > > >Regards, >Sha. > > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm |