Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Limiting a VFP app usable memory
Message
De
29/01/2004 10:43:42
 
 
À
29/01/2004 07:54:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00871717
Message ID:
00871813
Vues:
27
Thomas,

>There is an explicit EmptyWorkingSet(), which probably just calls with MemSize -1.

Very interesting API call, made some tests just to try to understand how it behaves.

I put the following code sequence to control access to one app menu system, this way I could loop thru the many functionalities of that app:
 Declare Integer GetCurrentProcess In kernel32 
 Declare Integer EmptyWorkingSet   In psapi  Integer hProcess

 Do While ! EndOfJob

    Read Events

    MessageBox ("It's going to issue the EmptyWorkingSet() API call")

    EmptyWorkingSet (GetCurrentProcess())

    Messagebox ("Issued the API call")

 EndDo
Now the figures for memory utilization:

1) The app starts ang goes idle: 7,776 kb
2) After minimizing the app: 728 kb (amazing he!)
3) After maximizing it again: 1,124 kb
4) Started a report generation procedure. After it finishes: 38,056 kb
5) After (4) perform the Print Preview: 40,268 kb
6) Returns to main loop, afer Print Preview: 40,124 kb (here it executes the MessageBox ("It's going to issue the EmptyWorkingSet() API call"))
7) Executes EmptyWorkingSet (GetCurrentProcess())
8) Executes Messagebox ("Issued the API call"): 1,548 kb (amazing again!)

All figures were taken using Win XP Pro Task Manager.

Well... it seems really great, while testing, but this is absolutelly new to me and I don't know if there are any pitfalls when using it. Please note that in the test I've made there was no use for Sys(1104) nor Sys(3050).

Is there any fellows that already made use of EmptyWorkingSet() to share opinions?

Thanks,

Fernando
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform