Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Page files (virtual memory)

Page files (virtual memory)

Page files (virtual memory)

For a very long time I have had a problem with my app using too much virtual memory (VM). After much testing I find that when the app runs a zero divide it uses page file space wich controls VM. I have many zero devides in the many calculations the program makes.  All work fine but I'd like to reset the page files to a lower number after the zero divide runs so as to prevent running out of VM. I know I can set a "what if" clause to stop running the zero devide calc but toooo much code to go through.  Any function or suggestions on how to solve this with out have to find the may zero devides and going with the "what if" clauses.  Looking for code that releases the number of page files used.  Help.

RE: Page files (virtual memory)

I'm a little confused by your posting.

From how I read it you expect to control the memory footprint of an application in the clipper code its self?

That can only be done by recompiling using a dynamic compiler.  I use blinker for this reason, it does a great job managing memory usage and has plenty of features to configure VMM if needed. I've found the defaults to work great.

What exactly is your application doing that needs to be fixed? Are you exhausting memory and crashing? Or are you getting divide by zero execution errors? Those are not necessarily the same.

You can have a divide by zero error from a logic error in your code or the VMM can report one when it has exhausted all memory.

Maybe you could reply with the exact error you are getting.


RE: Page files (virtual memory)

Thanks for your response. The program is a clipper back end program converted to windows useing Fivewin.  clipper 5.2 and blinker 7.  As the program dues a zero divide it uses more page files.  Thus if there are many zero divides the it will have to use more and more page files until the VM needs to be changed (XP does it automatically, increasing the size of the VM which reduces the speed of the program.) If there is a way to reset the page files downward after a zero divide, getting rid of the page file no longer needed then XP will not be required to reset the VM or number of page files and the program will not become sluggish..

Make any more sense?


RE: Page files (virtual memory)

Expain what you mean by  "zero divides"


RE: Page files (virtual memory)

when a number is divided by a zero.

nNumber  := 100
nNumber1 := 0

ie... nNumber/nNumber1

Number is being devide by zero.

RE: Page files (virtual memory)

I usually test for those before doing the calculation...


nNumber  := 100
nNumber1 := 0
if nNumber1 <> 0
  nResult = nNumber/nNumber1
  nResult = 0

So, that means I've not come across the problem!


Keep ing

RE: Page files (virtual memory)

You could do something using a BEGIN SEQUENCE and trapping the zero-divide, by generating a BREAK in the errorhandler when a divide by zero-error occurs, it would be like this (quote from the original Cl5.2 Norton Guide):


bLastHandler := ERRORBLOCK({    |objErr| MyHandler(objErr, .T.)})
   . <operation that might fail>
   . <send messages to objLocal and handle the error>
// Restore previous error handler
ERRORBLOCK( bLastHandler )

FUNCTION MyHandler( objError, lLocalHandler )
   // Handle locally returning the error object
   IF lLocalHandler
      BREAK objError
   . <other statements to handle the error>


RE: Page files (virtual memory)

The above advice is just what you need if your application is trying to divide by zero.

Memory management is not your problem.

RE: Page files (virtual memory)

There must already be an error handler in place which is handling the zero divide exception, otherwise the program would be crashing.

If zero divides are causing increased memory usage then the problem would be that the zero divide error handler is not properly cleaning up after the error and releasing working storage.

Offhand it is difficult to imagine how this is happening, but unless you are using some library which is providing the error recovery from zero division then the answer should be there in your code. If not, then TonHu's suggestion about writing your own would seem to be the way to go.

Alternatively, replacing all the divisions in your app with a call to a UDF incorporating a zero divisor test as Griff suggests should be pretty easily done on a global search and replace basis.


RE: Page files (virtual memory)

Thanks for all ofyour help. Griffs is the way to go but many zero divides in the program.  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close