Jump to content

Jud

Members
  • Content Count

    118
  • Joined

  • Last visited

Posts posted by Jud


  1. It is nothing like Fibonacci.  It is a depth-first search on a graph.  I'm not trying to make the recursion itself recursive - each time through the loop makes an independent call to the recursive procedure.  The instances of the procedure don't have anything to do with each other and there is no global data.  That is, I need to make parallel calls to the procedure; the recursion itself is not parallel.

     


  2. I've written several multi-threaded programs with the parallel library, usually using tasks but one or two using parallel for.  I have a new one that is more natural for parallel for.  The problem is that this is the first one that must use recursion.  Inside the loop there is some initial stuff and then it calls a procedure that calls itself, and that isn't working.

     

    If the parallel loop only has one iteration, e.g. parallel.for(1,1 ... ) or parallel.for(2,2 ... ), it works.  But for actual work, with the recursion and parallel.for, it locks up.

    How can I get a recursive procedure to work in a multi-threaded program?

     


  3. No solution.  If I remember correctly, 10.3 didn't have the problem.  10.4 had the problem but then 10.4.1 fixed the problem.  But then there were two patches to 10.4.1 that still had the problem.  I got 10.4.2 about 3 days ago, and Find Declaration has been working for me.  But Refactor/Rename doesn't work (and is worse).  Before Refactor/Rename would change the one where you have the cursor, but no others.  Now it doesn't even change the one at the cursor.


  4. 5 minutes ago, emailx45 said:

    here, I have a file created with your code with 1GBytes of size!

    I tryed open in Notepad++ / Wordpad and the app stay for many times and when I clicked it the app crash!

    this files very big for open all in one time!

     

    maybe using another software i can open, but I dont have software for this in my pc!

    EditPad Pro can open files bigger than 4GB. 


  5. 11 minutes ago, emailx45 said:
    • In my tests, in 64bits dont occurr any error by EIntOverFlow!
    • Only in 32bits, we have the Out Memory because:  "strings" -- NOTE: until NOTEPAD++ crash when try open your file-resulted.txt with more than size 1GB with "AAAAAAAAAAAAAAA....."
    • I have 16GB RAM and CPU 4x8 i7 4770K and is not enought for open the file, because, the software used try read the file whole on memory... Software like MSWord or similar, do paging to open big-files!
    • 
      System.Classes.pas, line 6815 =    SetString(Result, nil, Size); // Out Memory
    • as I show in my sample above!

     

    http://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.EIntOverflow

     

    Did you try in your system?

    In my development system I have 32GB and an i7.  There are 13 computers here, and their memory ranges from 32GB to 512GB.

     

    Yes, you get the out of memory error in 32-bit mode, which is why I have to use 64-bit mode.  The integer overflow occurs in 64-bit mode when using tStrings.SaveToFile method.

     

    The tStringList help page says that tStringList can hold up to 2,147,483,647 strings.    But if you have even 1,200,000,000 strings with even one character per sting, you will get the integer overflow error when trying to use the SaveToFile method.

    And it isn't because of Windows limit on file size, which is much larger. 

     

     


  6. 10 minutes ago, emailx45 said:
    • In my tests, in 64bits dont occurr any error by EIntOverFlow!
    • Only in 32bits, we have the Out Memory because:  "strings" -- NOTE: until NOTEPAD++ crash when try open your file-resulted.txt with more than size 1GB with "AAAAAAAAAAAAAAA....."
    • I have 16GB RAM and CPU 4x8 i7 4770K and is not enought for open the file, because, the software used try read the file whole on memory... Software like MSWord or similar, do paging to open big-files!
    • 
      System.Classes.pas, line 6815 =    SetString(Result, nil, Size); // Out Memory
    • as I show in my sample above!

     

    http://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.EIntOverflow

     

    Did you try in your system?

     


  7. 17 hours ago, Lajos Juhász said:

    Now back to the original problem. This is the limitation of Delphi strings. You cannot allocate string larger than: (MaxInt - SizeOf(StrRec)) div SizeOf(WideChar) = 1073741815.

     

    Unfortunately, internally TStringList first tries to convert its content to string and using TEncoding to a byte array. That's why it is not suitable to work with large volume of text.

     

    But with the 64-bit platform, why not increase it (use NativeInt).  Most computers these days have more than 4GB in them and hard drives 4TB and larger, with large files, are common.


  8. 17 hours ago, Lajos Juhász said:

    It's quite easy to test. I've tested using:
     

    
    procedure TForm1.Button1Click(Sender: TObject);
    var i: integer;
    begin
      i:=1024;
      while true do
        i:=i*i;
      ShowMessage('Completed. The result is:'+i.ToString);
    end;

     

    When tested using the 64 bit the call stack is:

    :00007FF965893E49 ; C:\WINDOWS\System32\KERNELBASE.dll
    System._RaiseAtExcept(???,???)
    System.SysUtils.ErrorHandler(???,$70AE52)
    System.ErrorAt(5,$70AE52)
    System._IntOver
    mainFRM.TForm1.Button1Click(???)
    Vcl.Controls.TControl.Click
    Vcl.StdCtrls.TCustomButton.Click
    Vcl.StdCtrls.TCustomButton.CNCommand(???)
    System.TObject.Dispatch((no value))

     

    But it's not bad, double click on the mainFRM.Tform1.Button1Click and the debugger focues where the 32 bit debugger does, so it's just an extra step. 

     

    My test case is different, but if I go down to "WriteStringsError.WriteStringsError and click on that, it does take me to the source line after the line that caused the error, so that helps.


  9. Just now, David Heffernan said:

    In what way? Can you be more specific. 

     

    As for the main problem, I'm not surprised. I'd expect that you'd be better off using a stream writer to write such a huge collection to a stream. I'd submit a bug report to QP, in case on doesn't already exist, and then write some helper code to workaround the issue. 

    Are you asking about my pet peeve about 64-bit Delphi not handling integer overflows?  It has always had this flaw in the 64-bit version.  If you have an integer overflow in the EXE, it just stops, with no error message,  If you are running it in the IDE, it doesn't take you to the line the error, as it does in the 32-bit version, and, as far as I know, it does with all other runtime errors.  An integer overflow in the 64-bit version in the IDE takes you to the obscure place in my message.

     

    When I have such an error in a 64-bit program, if I can I switch to 32-bit to see where the error is.  But many times that is not possible because the 64-bit version has to be used, usually because of memory.  And then it usually takes hours and hours to find the source code with the error.


  10. I'm getting an integer overflow error when writing more than about 2^30 characters in a tStringList using
    SaveToFile in 64-bit Delphi 10.4.1.  What I think is happening is that it is using two bytes per character
    and this is putting some number over 2^31 and overflowing an integer.  

    Is this one of the things that they haven't made 64-bit yet?

    If there are under about 1 billion characters, it works.  If there are more, it crashes. 

     

    When running the EXE file, it just stops running with no message.

     

    In the IDE, it takes
    you to:
    procedure _IntOver;
    {$IFDEF PUREPASCAL}
    begin
      ErrorAt(Byte(reIntOverflow), ReturnAddress);
    end;

    in the system unit.

    Which brings up another of my pet peeves: 64-bit Delphi has never handled integer overflows properly.

    A sample program is attached.

    SampleProgram.txt


  11. 12 minutes ago, FredS said:

    I added in my DPR right above madExcept (v5) and it worked fine.

     

    Did you use the NUMA Branch?

     

     

     

    I don't know how to do that - I haven't found good documentation on FastMM5.  It didn't make a difference on the memory-intensive program on a single-i7 machine.

×