Announcement

Collapse
No announcement yet.

Anybody know how to tell when w$ is finished setting up a swap file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anybody know how to tell when w$ is finished setting up a swap file?

    I am writing a program that deals with some rather large files (~700MB~ or so) and I am running across a problem. Consider the following code:
    Code:
    function pbmain
    ...process
    ...process
        te$ = DoSomething(m$)
    ...process
    ...process
        end function
    
    function DoSomething(temp$) as string
    ...process
    ...process
    function = temp$
    end function
    Now this works reasonably well with smaller files (200K to 15Meg).

    If, on the other hand, I have a large file 500M to 700M, without a sigificant delay (around one minute), the returned string winds up being nul length and an ERR = 0.

    The only thing I can think of is that, without a siginifient delay of around one minue, I am not giving w$ time enough to set up a swamp file.

    Is there any way of telling when w$ is finished?
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

  • #2
    Mel,
    try using #STACK 2000000 in your code.

    Paul.

    Comment


    • #3
      >the returned string winds up being nul length and an ERR = 0.

      Whatever PB function you are using does not return until Windows is done with the allocation, win, lose or draw, so there is no timing issue.

      Show failing code. If PB can't allocate memory for a "large" string it returns a null string and error 7 (insufficient memory).

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Try memory-mapping those big files. I always find that cuts down on some kind of overhead.

        These will give you a head start:

        Memory Mapped Files instead of RANDOM disk file access 5-8-04

        Memory-Mapped File Version of LINE INPUT
        Overview: http://www.powerbasic.com/support/pb...ad.php?t=?????


        Or... don't try to use strings that big. Work with managable-sized pieces of your files instead of the whole file data at once.
        Last edited by Michael Mattias; 31 Mar 2009, 08:53 AM.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment

        Working...
        X