<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=270532</guid>
        <pubDate>Thu, 25 Dec 2003 17:56:08 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=270532</link>
        <description><![CDATA[Петрович:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>javas</b>, 24.12.03, 02:48<br>может я чего не понял, как этот юнит работает, просто он вылетает на строчке <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br>У меня (Delphi 6) <b>MemCheck</b> прекрасно работает.<br><br>Для правильного использования этого модуля необходимо сделать следующее:<br><br>1. Вставить ссылку на модуль <b>MemCkeck</b> в список используемых модулей в файле проекта (.dpr);<br>2. Вставить вызов процедуры <b>MemChk</b> после <b>begin</b> в файле проекта (.dpr);<br>3. Выполнить следующие настройки в <b>Project Options</b>:<br>     <b>Compiler/Optimization</b>          - выключить<br>     <b>Compiler/Stack frames</b>          - включить<br>     <b>Compiler/Debugging</b>             - включить все в этой группе (<b>Use Debug DCUs</b> не обязательно, но желательно)<br>     <b>Linker/Include TD32 debug info</b> - включить<br>     <b>Packages/Runtime packages/Build with runtime packages</b>   - выключить<br><br>Например, сделал следующий проект:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->program Project1;<br>uses<br>  MemCheck, // &#60;---## Добавил ручками<br>  Forms,<br>  Unit1 in &#39;Unit1.pas&#39; {fmTestDA};<br><br>{&#036;R *.res}<br><br>begin<br>  MemChk;   // &#60;---## Добавил ручками<br>  Application.Initialize;<br>  Application.CreateForm&#40;TForm1, Form1&#41;;<br>  Application.Run;<br>end.<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Соответственно на Form1 пара кнопок со следующими обработчиками:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->procedure TForm1.Button1Click&#40;Sender&#58; TObject&#41;;<br>var p &#58;PChar;<br>begin<br>  GetMem&#40;p,100&#41;;<br>end;<br><br>procedure TForm1.Button2Click&#40;Sender&#58; TObject&#41;;<br>var p &#58;tStringList;<br>begin<br>  p &#58;= tStringList.Create;<br>end;<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Теперь запускаю. Если не нажимать никаких кнопок, то после завершения программы появляется файл <b>Project1_MemCheck.log</b> содержащий:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->MemCheck version 2.67<br><br>Total leak&#58; 0 bytes<br><br><br>*** MEMCHK&#58; Blocks STILL allocated ***<br><br>*** MEMCHK&#58; End of allocated blocks ***<br><br><br>*** MEMCHK&#58; Chronological leak information ***<br><br><br>*** MEMCHK&#58; End of chronological leak information ***<br><br><br>*** MEMCHK&#58; Blocks written to after destruction ***<br><br> Bad blocks count&#58; 0<br><br><br>*** MEMCHK&#58; End of blocks written to after destruction ***<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Если-же нажать сначала <b>Button1</b> а затем <b>Button2</b>, то после завершения файл <b>Project1_MemCheck.log</b> содержит:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->MemCheck version 2.67<br><br>Total leak&#58; 148 bytes<br><br><br>*** MEMCHK&#58; Blocks STILL allocated ***<br><br>Leak #0 Instance of TStringList<br> Size&#58; 48<br> 1 Occurence<br> call stack - 0 &#58; Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 54 Find error&#58; 005009D0<br> call stack - 1 &#58; Module Controls.pas Routine @Controls@TControl@Click Line 4621 Find error&#58; 0045247C<br> call stack - 2 &#58; Module StdCtrls.pas Routine @Stdctrls@TButton@Click Line 3347 Find error&#58; 0043FCC4<br> call stack - 3 &#58; Module StdCtrls.pas Routine @Stdctrls@TButton@CNCommand Line 3399 Find error&#58; 0043FE2B<br> call stack - 4 &#58; Module Controls.pas Routine @Controls@TControl@WndProc Line 4561 Find error&#58; 0045224E<br> call stack - 5 &#58; Module Controls.pas Routine @Controls@TWinControl@WndProc Line 6242 Find error&#58; 00455D1B<br> call stack - 6 &#58; Module StdCtrls.pas Routine @Stdctrls@TButtonControl@WndProc Line 3327 Find error&#58; 0043FC0F<br> call stack - 7 &#58; Module Controls.pas Routine @Controls@TControl@Perform Line 4468 Find error&#58; 00451F59<br> call stack - 8 &#58; Module Controls.pas Routine @Controls@DoControlMsg Line 6288 Find error&#58; 00455EDD<br> call stack - 9 &#58; Module Controls.pas Routine @Controls@TWinControl@WMCommand Line 6474 Find error&#58; 004566BA<br> call stack - 10 &#58; Module Controls.pas Routine @Controls@TControl@WndProc Line 4561 Find error&#58; 0045224E<br> call stack - 11 &#58; Module Controls.pas Routine @Controls@TWinControl@WndProc Line 6242 Find error&#58; 00455D1B<br> call stack - 12 &#58; Module Controls.pas Routine @Controls@TWinControl@MainWndProc Line 6139 Find error&#58; 004558EB<br> call stack - 13 &#58; Module classes.pas Routine @Classes@StdWndProc Line 10562 Find error&#58; 0042B9A6<br> call stack - 14 &#58; &#40;no debug info&#41; Find error&#58; 77D57B13<br> call stack - 15 &#58; &#40;no debug info&#41; Find error&#58; 77D5CDCA<br> call stack - 16 &#58; &#40;no debug info&#41; Find error&#58; 77D34599<br> call stack - 17 &#58; &#40;no debug info&#41; Find error&#58; 77D347B0<br> call stack - 18 &#58; &#40;no debug info&#41; Find error&#58; 77F5108B<br> call stack - 19 &#58; &#40;no debug info&#41; Find error&#58; 77D361F2<br> call stack - 20 &#58; &#40;no debug info&#41; Find error&#58; 77D4EBFE<br> call stack - 21 &#58; &#40;no debug info&#41; Find error&#58; 77D4C3F2<br> call stack - 22 &#58; &#40;no debug info&#41; Find error&#58; 77D57B13<br> call stack - 23 &#58; &#40;no debug info&#41; Find error&#58; 77D5CDCA<br> call stack - 24 &#58; &#40;no debug info&#41; Find error&#58; 77D35CC5<br> call stack - 25 &#58; &#40;no debug info&#41; Find error&#58; 77D35CE4<br> call stack - 26 &#58; Module Controls.pas Routine @Controls@TWinControl@DefaultHandler Line 6269 Find error&#58; 00455E61<br><br>Leak #1 User allocated memory &#40;GetMem&#41;<br> Size&#58; 100<br> 1 Occurence<br> call stack - 0 &#58; Module Unit1.pas Routine @Unit1@TForm1@Button1Click Line 47 Find error&#58; 005009AE<br> call stack - 1 &#58; Module Controls.pas Routine @Controls@TControl@Click Line 4621 Find error&#58; 0045247C<br> call stack - 2 &#58; Module StdCtrls.pas Routine @Stdctrls@TButton@Click Line 3347 Find error&#58; 0043FCC4<br> call stack - 3 &#58; Module StdCtrls.pas Routine @Stdctrls@TButton@CNCommand Line 3399 Find error&#58; 0043FE2B<br> call stack - 4 &#58; Module Controls.pas Routine @Controls@TControl@WndProc Line 4561 Find error&#58; 0045224E<br> call stack - 5 &#58; Module Controls.pas Routine @Controls@TWinControl@WndProc Line 6242 Find error&#58; 00455D1B<br> call stack - 6 &#58; Module StdCtrls.pas Routine @Stdctrls@TButtonControl@WndProc Line 3327 Find error&#58; 0043FC0F<br> call stack - 7 &#58; Module Controls.pas Routine @Controls@TControl@Perform Line 4468 Find error&#58; 00451F59<br> call stack - 8 &#58; Module Controls.pas Routine @Controls@DoControlMsg Line 6288 Find error&#58; 00455EDD<br> call stack - 9 &#58; Module Controls.pas Routine @Controls@TWinControl@WMCommand Line 6474 Find error&#58; 004566BA<br> call stack - 10 &#58; Module Controls.pas Routine @Controls@TControl@WndProc Line 4561 Find error&#58; 0045224E<br> call stack - 11 &#58; Module Controls.pas Routine @Controls@TWinControl@WndProc Line 6242 Find error&#58; 00455D1B<br> call stack - 12 &#58; Module Controls.pas Routine @Controls@TWinControl@MainWndProc Line 6139 Find error&#58; 004558EB<br> call stack - 13 &#58; Module classes.pas Routine @Classes@StdWndProc Line 10562 Find error&#58; 0042B9A6<br> call stack - 14 &#58; &#40;no debug info&#41; Find error&#58; 77D57B13<br> call stack - 15 &#58; &#40;no debug info&#41; Find error&#58; 77D5CDCA<br> call stack - 16 &#58; &#40;no debug info&#41; Find error&#58; 77D34599<br> call stack - 17 &#58; &#40;no debug info&#41; Find error&#58; 77D347B0<br> call stack - 18 &#58; &#40;no debug info&#41; Find error&#58; 77F5108B<br> call stack - 19 &#58; &#40;no debug info&#41; Find error&#58; 77D361F2<br> call stack - 20 &#58; &#40;no debug info&#41; Find error&#58; 77D4EBFE<br> call stack - 21 &#58; &#40;no debug info&#41; Find error&#58; 77D4C3F2<br> call stack - 22 &#58; &#40;no debug info&#41; Find error&#58; 77D57B13<br> call stack - 23 &#58; &#40;no debug info&#41; Find error&#58; 77D5CDCA<br> call stack - 24 &#58; &#40;no debug info&#41; Find error&#58; 77D35CC5<br> call stack - 25 &#58; &#40;no debug info&#41; Find error&#58; 77D35CE4<br> call stack - 26 &#58; Module Controls.pas Routine @Controls@TWinControl@DefaultHandler Line 6269 Find error&#58; 00455E61<br><br>*** MEMCHK&#58; End of allocated blocks ***<br><br><br>*** MEMCHK&#58; Chronological leak information ***<br><br>* User allocated memory &#40;GetMem&#41; &#40;Leak #1&#41; Size&#58; 100<br>* Instance of TStringList &#40;Leak #0&#41; Size&#58; 48<br><br>*** MEMCHK&#58; End of chronological leak information ***<br><br><br>*** MEMCHK&#58; Blocks written to after destruction ***<br><br> Bad blocks count&#58; 0<br><br><br>*** MEMCHK&#58; End of blocks written to after destruction ***<br><br><br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Вот так. ]]></description>
        <author>Петрович</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=269240</guid>
        <pubDate>Tue, 23 Dec 2003 23:48:25 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=269240</link>
        <description><![CDATA[javas:  Все в порядке, размер получается как до, так и после тем же&#33; Просто отлично, но<br>может я чего не понял, как этот юнит работает, просто он вылетает на строчке <br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>mov eax, &#91;ebp + 12&#93;<!--c2--></td></tr></table><div class='postcolor'><!--ec2--> в функции<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>function ltgmCallerIsNewAnsiString&#58; boolean;<br>&nbsp;//Tells if the guy who called GetMem is NewAnsiString<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>после<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>IntToStr&#40;Beg^.Adr1.LtCurrent.Age&#41;;<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>И на всех таких с функцией IntToStr(), и говорит, что все равно есть утечка, хоть диспечер и показывает, что вроде все нормально&#33;<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>Ошибка&#58;Access violation at adress...<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--> ]]></description>
        <author>javas</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=269238</guid>
        <pubDate>Tue, 23 Dec 2003 23:43:25 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=269238</link>
        <description><![CDATA[Петрович:  Может утечка, а может и особенности распределителя памяти Delphi.<br>По поводу обнаружения утечек. Есть модуль MemCheck позволяющий обнаруживать утечки. <a href='http://v.mahon.free.fr/pro/freeware/memcheck' target='_blank'>См. здесь</a> ]]></description>
        <author>Петрович</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=269226</guid>
        <pubDate>Tue, 23 Dec 2003 23:10:12 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=269226</link>
        <description><![CDATA[javas:  Тут возникает такой вопрос, если я динамически создаю список, например, диспечер показывает, что размер виртуальной памяти для приложения был 2024, запускаю создание списка и вижу, что размер доходит до 30000 потом снижается до 19000, т.е. почему за моим приложением осталось лишнее место, если я его не использую <!--emo&:o--><img src='http://forum.sources.ru/html/emoticons/ohmy.gif' border='0' style='vertical-align:middle' alt='ohmy.gif' /><!--endemo-->, при повторном создании 19000 увеличивается, т.е. это значит утечка есть  <!--emo&&lt;_&lt;--><img src='http://forum.sources.ru/html/emoticons/dry.gif' border='0' style='vertical-align:middle' alt='dry.gif' /><!--endemo--><br><br>Как ее выявить и избежать? ]]></description>
        <author>javas</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267611</guid>
        <pubDate>Sun, 21 Dec 2003 15:01:19 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267611</link>
        <description><![CDATA[Петрович:  Господа. Приношу свои извинения за ошибочные сведения которые я привел в своем сообщении №8  <!--emo&:ph34r:--><img src='http://forum.sources.ru/html/emoticons/ph34r.gif' border='0' style='vertical-align:middle' alt='ph34r.gif' /><!--endemo--> - Сильно не бейте <!--emo&:)--><img src='http://forum.sources.ru/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->.<br>Теперь подробнее.<br>Когда я писал о выполненной мной проверке, я имел в виду следующий код:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->procedure TestGetMem;<br>const Size &#58;Cardinal = 3*Cardinal&#40;1024*1024*1024&#41;;<br>var   p    &#58;PChar;<br>begin<br>  try<br>    GetMem&#40;p,Size&#41;;<br>    try<br>      FillChar&#40;p^,Size,0&#41;;<br>      Windows.MessageBox&#40;GetActiveWindow,&#39;Ok&#39;,&#39;&#39;,0&#41;;<br>    finally<br>      FreeMem&#40;p&#41;;<br>    end;<br>  except on e&#58;Exception do<br>    Windows.MessageBox&#40;GetActiveWindow,PChar&#40;&#39;Error&#58;&#39;+e.Message&#41;,&#39;&#39;,0&#41;;<br>  end;<br>end;<!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Замечу, что код выполняется без Exception, из чего я и сделал предположение что мне дали запрошенные 3Гб. Иначе, было-бы Exception, в соответствии с описанием на Delphi 6:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->If there isn&#39;t enough memory available to allocate the dynamic variable, an EOutOfMemory exception is raised. <!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Вот отсюда и неверность моего ответа (причем я сам был удивлен).<br><br>Теперь, я решил более подробно исследовать вопрос. Вот код который я написал:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->procedure TestGetMem;<br><br>  procedure Test &#40;s &#58;String; Size &#58;Cardinal&#41;;<br>  var p &#58;PChar;<br>  begin<br>    try<br>      GetMem&#40;p,Size&#41;;<br>      if  p = nil  then<br>        Log&#40;s+&#39; - Nil &#33;&#39;&#41;<br>      else begin<br>        Log&#40;s+&#39; - Ok&#39;&#41;;<br>        FreeMem&#40;p&#41;;<br>      end;<br>    except on e&#58;Exception do<br>      Log&#40;s+&#39; - Exception&#58; &#39;+e.Message&#41;;<br>    end;<br>  end;<br><br>const<br>  Mb = Cardinal&#40;1024*1024&#41;;<br>  Gb = Cardinal&#40;1024*1024*1024&#41;;<br>begin<br>  Test&#40;&#39;3 Gb         &#39;,3*Gb          &#41;;<br>  Test&#40;&#39;2 Gb         &#39;,2*Gb          &#41;;<br>  Test&#40;&#39;2*Gb - 1b    &#39;,2*Gb - 1      &#41;;<br>  Test&#40;&#39;2*Gb - 10b   &#39;,2*Gb - 10     &#41;;<br>  Test&#40;&#39;1*Gb + 150*Mb&#39;,1*Gb + 150*Mb &#41;;<br>end;<!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>После его запуска я получил результат еще больше удививший меня <!--emo&:blink:--><img src='http://forum.sources.ru/html/emoticons/blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' /><!--endemo--> :<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->3 Gb          - Nil &#33;<br>2 Gb          - Nil &#33;<br>2*Gb - 1b     - Exception&#58; Не хватает памяти<br>2*Gb - 10b &nbsp; &nbsp;- Exception&#58; Нарушение доступа по адресу 00401D5E в модуле &#39;Project1.exe&#39;. Запись по адресу 8099BFFC<br>1*Gb + 150*Mb - Ok<!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br>Особое удивление вызывает 4-я строка (2*Gb-10b). Хотя строки 1 и 2 тоже вызывают привычное ощущение - опять обманули (см. цитату из справки).<br>Вот и все, выводы можете делать сами.<br>Да, забыл уточнить. Ипытание проводиолсь в среде Delphi 6 под Windows XP.<br>И еще, если кто захочет попробовать, <b>Log</b> - это моя функция, аналогом может быть что-то вроде:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->procedure Log &#40;s &#58;String&#41;;<br>begin<br>&nbsp; Form1.Memo.Lines.Add&#40;s&#41;;<br>end;<!--c2--></td></tr></table><div class='postcolor'><!--ec2--> ]]></description>
        <author>Петрович</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267430</guid>
        <pubDate>Sun, 21 Dec 2003 07:37:51 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267430</link>
        <description><![CDATA[trainer:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>Петрович</b>, 20.12.03, 17:17<br>Так вот, 3 с лишним Гб дали легко&#33;.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->Если верить Джеффри Рихтеру, а не верить ему нет оснований, такое должно быть только в линейке WinNT для 64-разрядных процессоров(IA-64,Alpha). Там приложению отведено 4 ТБ.<br>Так что если это 32-разрядная версия Windows, то любопытно посмотреть на код.<br> ]]></description>
        <author>trainer</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267401</guid>
        <pubDate>Sun, 21 Dec 2003 06:33:44 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267401</link>
        <description><![CDATA[Song: <!--QuoteBegin-Петрович+20.12.03, 17:17--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> (Петрович @ 20.12.03, 17:17)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Сначала хотел ответить так-же, но решил сначала сам проверить. Так вот, 3 с лишним Гб дали легко&#33;. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd--><br> Приведи код вызова и как ты определял. ]]></description>
        <author>Song</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267381</guid>
        <pubDate>Sun, 21 Dec 2003 04:07:57 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267381</link>
        <description><![CDATA[Vit:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>Петрович</b>, 20.12.03, 09:17<br>Сначала хотел ответить так-же, но решил сначала сам проверить. Так вот, 3 с лишним Гб дали легко&#33;.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br><br><br>А какая винда? Есть предположение что этакие штуки только в 2000/XP проходят, а в более древних виндах всё те же 2Gb... ]]></description>
        <author>Vit</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267131</guid>
        <pubDate>Sat, 20 Dec 2003 14:17:15 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267131</link>
        <description><![CDATA[Петрович:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>trainer</b>, 20.12.03, 13:33<br>Такого никогда не дадут&nbsp; В Win32 под приложение отводится 2ГБ(если хорошо попросить, то 3ГБ), реально немного меньше.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br>Сначала хотел ответить так-же, но решил сначала сам проверить. Так вот, 3 с лишним Гб дали легко&#33;.<br><!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>trainer</b>, 20.12.03, 13:33<br>А как же GetHeapStatus?<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br>Дак как я и сказал - скажут что есть, а потом могут недать.<br><!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>trainer</b>, 20.12.03, 13:33<br>У каждого процесса своя виртуальная память, так что про другие процессы с определенными ограничениями можно забыть.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br>Так-то оно так. Но, во первых, в рамках своего процесса порой работают и потоки и модули о которых мало что известно (COM-объекты, Dll, и т.п.), а они тоже памяти хотят, причем именно памяти твоего процесса. А во вторых, да, другие процессы имеют свою виртуальную память. Но надо понимать что ВСЯ виртуальная память отображается на единственную физическую память и HDD. Поэтому, все процессы черпают ее из одной кастрюльки, увы не бесконечной <!--emo&:)--><img src='http://forum.sources.ru/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->.<br> ]]></description>
        <author>Петрович</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267013</guid>
        <pubDate>Sat, 20 Dec 2003 10:33:13 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=267013</link>
        <description><![CDATA[trainer:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>Петрович</b>, 19.12.03, 03:18<br>Во вторых, могут столько и не дать, если места на диске мало<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->Такого никогда не дадут <!--emo&:)--><img src='http://forum.sources.ru/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo--> В Win32 под приложение отводится 2ГБ(если хорошо попросить, то 3ГБ), реально немного меньше.<br><!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>Петрович</b>, 19.12.03, 03:18<br>А если серьезно, то с точностью до байта, как в старом недобром DOS&#39;е давал MaxAvail, под виндами получить невозможно <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->А как же GetHeapStatus?<br><!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>Петрович</b>, 19.12.03, 03:18<br>Т.е. если даже предположить наличие такой функции, то между моментом ее вызова и моментом вызова функции запроса памяти, другой нехороший процесс может сожрать всю обещаную Вам память.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->У каждого процесса своя виртуальная память, так что про другие процессы с определенными ограничениями можно забыть. <!--emo&:)--><img src='http://forum.sources.ru/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo--><br> ]]></description>
        <author>trainer</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=266975</guid>
        <pubDate>Sat, 20 Dec 2003 09:38:27 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=266975</link>
        <description><![CDATA[javas:  ОК, понятно&#33;  <!--emo&:D--><img src='http://forum.sources.ru/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->  ]]></description>
        <author>javas</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=266288</guid>
        <pubDate>Fri, 19 Dec 2003 00:18:51 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=266288</link>
        <description><![CDATA[Петрович:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>Fantasist</b>, 18.12.03, 03:37<br>MaxAvail пишиться очень просто. Вот так:<br><br>function MaxAvail:integer;<br>begin<br>&nbsp; Result:=4*1024*1024*1024; //4 гига.<br>end;<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br><br>Во первых, при компиляции такого ты получишь <b>Overflow in conversion or arithmetic operation</b>.<br>Во вторых, могут столько и не дать, если места на диске мало <!--emo&:)--><img src='http://forum.sources.ru/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->.<br><br>А если серьезно, то с точностью до байта, как в старом недобром DOS&#39;е давал MaxAvail, под виндами получить невозможно - система многозадачная, в ней все постоянно живет, меняется. Т.е. если даже предположить наличие такой функции, то между моментом ее вызова и моментом вызова функции запроса памяти, другой нехороший процесс может сожрать всю обещаную Вам память.<br><br>Под виндами, как и в других многозадачных системах, обычно используется другая стратегия:<br>Вы просто запрашиваете необходимый Вам объем памяти, а потом смотрите дали Вам ее или нет.<br> ]]></description>
        <author>Петрович</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=265590</guid>
        <pubDate>Thu, 18 Dec 2003 00:37:41 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=265590</link>
        <description><![CDATA[Fantasist:  <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>Цитата</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin--><b>javas</b>, 15.12.03, 17:34<br>Вообще-то я не то написал MaxAvail надо было&#33;<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd--><br><br>MaxAvail пишиться очень просто. Вот так:<br><br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>function MaxAvail&#58;integer;<br>begin<br>&nbsp; Result&#58;=4*1024*1024*1024; //4 гига.<br>end;<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br> ]]></description>
        <author>Fantasist</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=263994</guid>
        <pubDate>Mon, 15 Dec 2003 17:34:20 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=263994</link>
        <description><![CDATA[javas:  Ну, ты загнул, конечно это реальная проблема&#33; <br>Вообще-то я не то написал MaxAvail надо было&#33;<br>Вот это все как? Мне вообщем функция, которая говорит сколько место в heap:<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>Status.dwMemoryLoad&#58; Количество используемой памяти в процентах &#40;%&#41;. <br>Status.dwTotalPhys&#58; Общее количество физической памяти в байтах. <br>Status.dwAvailPhys&#58; Количество оставшейся физической памяти в байтах. <br>Status.dwTotalPageFile&#58; Объём страничного файла в байтах. <br>Status.dwAvailPageFile&#58; Свободного места в страничном файле. <br>Status.dwTotalVirtual&#58; Общий объём виртуальной памяти в байтах. <br>Status.dwAvailVirtual&#58; Количество свободной виртуальной памяти в байтах.<!--c2--></td></tr></table><div class='postcolor'><!--ec2--> ]]></description>
        <author>javas</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=263085</guid>
        <pubDate>Sun, 14 Dec 2003 03:37:29 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=263085</link>
        <description><![CDATA[Vit:  Это реальная проблема с которой вы столкнулись или переделывается 16 битная программа с TP/Delphi1 или Вы только пересели на Дельфи из какой-то 16ти битной среды программирования? ]]></description>
        <author>Vit</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=262591</guid>
        <pubDate>Sat, 13 Dec 2003 10:01:00 +0000</pubDate>
        <title>Какой аналог MemAvail в Delphi</title>
        <link>https://forum.sources.ru/index.php?showtopic=40497&amp;view=findpost&amp;p=262591</link>
        <description><![CDATA[javas:  Если мы добавляем элемент в список, то проверяем сколько есть в Heap if memavail&lt;SizeOf(нужный элемент) then exit;<br>Как такое можно реализовать в Delphi?<br> ]]></description>
        <author>javas</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      </channel>
      </rss>
	