Out of system resources exception

Hi,

I have an application used to auto-reply to emails sent to an specific mailbox. I use TIdSMTP to send the emails.

The applications runs for some hours but at some point an 'Out of system resources' exception is generated and the application is forced to close. Sometimes it runs for 2 hours, sometimes more or less. But the exception always are threw and i don't know why this happens. Sometimes another exception is generated : 'Out of memory'.

So i need to keep monitoring the application to reopen it in case of crash.

How can i trace an error likes this ?

Thanks in advance !
0
daniel
10/22/2013 12:54:07 PM
embarcadero.delphi.vcl.using 2297 articles. 2 followers. Follow

28 Replies
4075 Views

Similar Articles

[PageSpeed] 24

daniel

>The applications runs for some hours but at some point an 'Out of system resources' exception is generated and the application is forced to close. Sometimes it runs for 2 hours, sometimes more or less. But the exception always are threw and i don't know why this happens. Sometimes another exception is generated : 'Out of memory'.
>
>So i need to keep monitoring the application to reopen it in case of crash.
>
>How can i trace an error likes this ?

Most likely guess is that you're creating something that you're not freeing. Try using FastMM to check for memory leaks (you'll need to run and then stop before it crashes). You can also look at tools like MadExcept to see if it pinpoints the problem.

I don't like Indy so my first action if it was my app would be to replace Indy with Synapse.

Roy
0
Roy
10/22/2013 1:29:23 PM
> {quote:title=Roy Lambert wrote:}{quote}
> daniel
> 
> >The applications runs for some hours but at some point an 'Out of system resources' exception is generated and the application is forced to close. Sometimes it runs for 2 hours, sometimes more or less. But the exception always are threw and i don't know why this happens. Sometimes another exception is generated : 'Out of memory'.
> >
> >So i need to keep monitoring the application to reopen it in case of crash.
> >
> >How can i trace an error likes this ?
> 
> Most likely guess is that you're creating something that you're not freeing. Try using FastMM to check for memory leaks (you'll need to run and then stop before it crashes). You can also look at tools like MadExcept to see if it pinpoints the problem.
> 
> I don't like Indy so my first action if it was my app would be to replace Indy with Synapse.
> 
> Roy

Thank you Roy. I've installed FastMM and indeed it shows lots of memory leaks after i close the application, but i have no clue how to detect it. For instance, the report generated below shows leaks in VCLs components ; how can i fix it ?

Thanks in advance !

A memory block has been leaked. The size is: 36

This block was allocated by thread 0x1A5C, and the stack trace (return addresses) at the time was:
403266 [sys\system.pas][System][@GetMem][2654]
43A3EA [Graphics.pas][Graphics][TResourceManager.AllocResource][1317]
43B5F9 [Graphics.pas][Graphics][TPen.Create][1983]
43BD1E [Graphics.pas][Graphics][TCanvas.Create][2341]
4782C4 [Controls.pas][Controls][TCustomControl.Create][10133]
477983 [Controls.pas][Controls][THintWindow.Create][9836]
48E188 [Forms.pas][Forms][TApplication.SetShowHint][8465]
47BC62 [Controls.pas][Controls][InitControls][12438]
706630 
40582B [sys\system.pas][System][InitUnits][11397]
405893 [sys\system.pas][System][@StartExe][11462]

The block is currently used for an object of class: Unknown
0
daniel
10/22/2013 4:30:56 PM
daniel

>Thank you Roy. I've installed FastMM and indeed it shows lots of memory leaks after i close the application, but i have no clue how to detect it. For instance, the report generated below shows leaks in VCLs components ; how can i fix it ?
>
>Thanks in advance !
>
>A memory block has been leaked. The size is: 36
>
>This block was allocated by thread 0x1A5C, and the stack trace (return addresses) at the time was:
>403266 [sys\system.pas][System][@GetMem][2654]
>43A3EA [Graphics.pas][Graphics][TResourceManager.AllocResource][1317]
>43B5F9 [Graphics.pas][Graphics][TPen.Create][1983]
>43BD1E [Graphics.pas][Graphics][TCanvas.Create][2341]
>4782C4 [Controls.pas][Controls][TCustomControl.Create][10133]
>477983 [Controls.pas][Controls][THintWindow.Create][9836]
>48E188 [Forms.pas][Forms][TApplication.SetShowHint][8465]
>47BC62 [Controls.pas][Controls][InitControls][12438]
>706630
>40582B [sys\system.pas][System][InitUnits][11397]
>405893 [sys\system.pas][System][@StartExe][11462]
>
>The block is currently used for an object of class: Unknown

First thing you need to do is add debug info into the project, then go into full debug mode with FastMM (you'll need FastMM_FullDebugMode.dll) and set it to output to a file. That will give you the actual line in you code. There is a stage you can carry out before that. In your code check that for every .Create there is a .Free AND that the .Free is always reached.

Roy
0
Roy
10/22/2013 4:43:54 PM
daniel wrote:

> Thank you Roy. I've installed FastMM and indeed it shows lots of
> memory leaks after i close the application, but i have no clue how to
> detect it. For instance, the report generated below shows leaks in
> VCLs components ; how can i fix it ?

Leaks caused by the core CL can usually be ignored.  What is more important 
is to look for leaks caused by your own code, so you need to look for your 
own classes/routines mentioned in the stack trace for each leak.

--
Remy Lebeau (TeamB)
0
Remy
10/22/2013 6:36:12 PM
Roy wrote:

> First thing you need to do is add debug info into the project,
> then go into full debug mode with FastMM (you'll need
> FastMM_FullDebugMode.dll) and set it to output to a file.

You will have to download the full version of FastMM (http://fastmm.sourceforge.net) 
in order to activate full debug mode.  You can then also configure how it 
outputs its log data (not just to a file), and well as the level of detail 
included in the log (stack traces, memory dumps, etc).

--
Remy Lebeau (TeamB)
0
Remy
10/22/2013 6:38:05 PM
> {quote:title=Roy Lambert wrote:}{quote}
> daniel
> 
> >Thank you Roy. I've installed FastMM and indeed it shows lots of memory leaks after i close the application, but i have no clue how to detect it. For instance, the report generated below shows leaks in VCLs components ; how can i fix it ?
> >
> >Thanks in advance !
> >
> >A memory block has been leaked. The size is: 36
> >
> >This block was allocated by thread 0x1A5C, and the stack trace (return addresses) at the time was:
> >403266 [sys\system.pas][System][@GetMem][2654]
> >43A3EA [Graphics.pas][Graphics][TResourceManager.AllocResource][1317]
> >43B5F9 [Graphics.pas][Graphics][TPen.Create][1983]
> >43BD1E [Graphics.pas][Graphics][TCanvas.Create][2341]
> >4782C4 [Controls.pas][Controls][TCustomControl.Create][10133]
> >477983 [Controls.pas][Controls][THintWindow.Create][9836]
> >48E188 [Forms.pas][Forms][TApplication.SetShowHint][8465]
> >47BC62 [Controls.pas][Controls][InitControls][12438]
> >706630
> >40582B [sys\system.pas][System][InitUnits][11397]
> >405893 [sys\system.pas][System][@StartExe][11462]
> >
> >The block is currently used for an object of class: Unknown
> 
> First thing you need to do is add debug info into the project, then go into full debug mode with FastMM (you'll need FastMM_FullDebugMode.dll) and set it to output to a file. That will give you the actual line in you code. There is a stage you can carry out before that. In your code check that for every .Create there is a .Free AND that the .Free is always reached.
> 
> Roy

I've installed FastMM and copied the DLL to bin directory as explained by the instructions in FastMM page. I've also twaked some preferences in Project Options. However i can't see the line number in the log file, i can oly see the memory addresses, and these are useful for find where the problem is. Any hint ?

Thanks !
0
daniel
10/22/2013 6:49:59 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> daniel wrote:
> 
> > Thank you Roy. I've installed FastMM and indeed it shows lots of
> > memory leaks after i close the application, but i have no clue how to
> > detect it. For instance, the report generated below shows leaks in
> > VCLs components ; how can i fix it ?
> 
> Leaks caused by the core CL can usually be ignored.  What is more important 
> is to look for leaks caused by your own code, so you need to look for your 
> own classes/routines mentioned in the stack trace for each leak.

How much leak an application needs to do to thrown an exception like 'Out of system resources' or 'Out of memory' ? Is there any other cause for these exceptions ? 

I yet will do further tests, but in my preliminary tests my app has really a few leaks, and summed they don't sum even 10kb...

Thanks
0
daniel
10/22/2013 6:52:12 PM
daniel wrote:

> How much leak an application needs to do to thrown an exception like
> 'Out of system resources' or 'Out of memory' ?

It really depends on what is raising the exceptions in the first place.  
For instance, you might be exhausting GDI resources, or more likely causing 
a failure during a GDI operation (which is usually reported as an out of 
resource error since GDI does not offer very good error handling), which 
has nothing to do with memory leaks.

FastMM is good at reporting memory leaks at app shutdown.  What you really 
need is an exception logger, such as MadExcept or EurekaLog, to report details 
about exceptions as they are happening in real time while your app is still 
running.

--
Remy Lebeau (TeamB)
0
Remy
10/22/2013 7:03:03 PM
daniel


>I've installed FastMM and copied the DLL to bin directory as explained by the instructions in FastMM page. I've also twaked some preferences in Project Options. However i can't see the line number in the log file, i can oly see the memory addresses, and these are useful for find where the problem is. Any hint ?

That sounds as though you don't have the debug information built in. In D2006 I set the map file to detailed and the TDS32 debug info on in Project Options | Linker

Roy
0
Roy
10/23/2013 8:02:27 AM
daniel

>How much leak an application needs to do to thrown an exception like 'Out of system resources' or 'Out of memory' ? Is there any other cause for these exceptions ?
>
>I yet will do further tests, but in my preliminary tests my app has really a few leaks, and summed they don't sum even 10kb...

Thinking about it I had an old D6 application (mail & news client) which occasionally did the same thing. I never did manage to fix it :(

I think I came to the conclusion that it was some sort of graphics operation, maybe a malformed image in the email that just objected now and again.

So said <<I have an application used to auto-reply to emails sent to an specific mailbox. I use TIdSMTP to send the emails.>> so a few more questions:

1. Do you read the emails first or just parse the headers?

2. When you send a reply do you include the original email in the body?

3. Are you doing any sort of graphical manipulation?

Roy
0
Roy
10/23/2013 8:07:27 AM
Remy Lebeau (TeamB) wrote:

> you might be exhausting GDI resources, or more likely causing a
> failure during a GDI operation (which is usually
> reported as an out of resource error since GDI does not offer very
> good error handling)

To check this "quick and dirty" use Windows's task manager (add
appropriate watches, namely GDI resources, handles, threads, etc.)

-- 
Alex
0
Alex
10/23/2013 8:33:25 AM
> {quote:title=Roy Lambert wrote:}{quote}
> daniel
> 
> >How much leak an application needs to do to thrown an exception like 'Out of system resources' or 'Out of memory' ? Is there any other cause for these exceptions ?
> >
> >I yet will do further tests, but in my preliminary tests my app has really a few leaks, and summed they don't sum even 10kb...
> 
> Thinking about it I had an old D6 application (mail & news client) which occasionally did the same thing. I never did manage to fix it :(
> 
> I think I came to the conclusion that it was some sort of graphics operation, maybe a malformed image in the email that just objected now and again.
> 
> So said <<I have an application used to auto-reply to emails sent to an specific mailbox. I use TIdSMTP to send the emails.>> so a few more questions:
> 
> 1. Do you read the emails first or just parse the headers?
> 
> 2. When you send a reply do you include the original email in the body?
> 
> 3. Are you doing any sort of graphical manipulation?


Hello Roy !

1. Yes, i download the emails using a TIdPop3, and parse the headers and body to generated the suitable auto-reply.
2. No
3. I only have some labels in the form to show the progress.



> 
> Roy
0
daniel
10/23/2013 11:34:53 AM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> daniel wrote:
> 
> > How much leak an application needs to do to thrown an exception like
> > 'Out of system resources' or 'Out of memory' ?
> 
> It really depends on what is raising the exceptions in the first place.  
> For instance, you might be exhausting GDI resources, or more likely causing 
> a failure during a GDI operation (which is usually reported as an out of 
> resource error since GDI does not offer very good error handling), which 
> has nothing to do with memory leaks.
> 
> FastMM is good at reporting memory leaks at app shutdown.  What you really 
> need is an exception logger, such as MadExcept or EurekaLog, to report details 
> about exceptions as they are happening in real time while your app is still 
> running.

After some further tests, i could fix a few leaks in my app. Now the only leaks remaining are these below :

5 - 12 bytes: TIdThreadSafeInteger x 1
21 - 36 bytes: TIdCriticalSection x 2, TBrush x 1, TFont x 1, TPen x 1, Unknown x 2
53 - 68 bytes: TBitmap x 1, Unknown x 1
85 - 100 bytes: TBitmapCanvas x 1
101 - 116 bytes: TBitmapImage x 1


I think all of them are related to VCL core, i could not track them. And my app still throws the exception 'Out of memory' after a couple of hours : /
0
daniel
10/23/2013 11:36:29 AM
daniel

>After some further tests, i could fix a few leaks in my app. Now the only leaks remaining are these below :
>
>5 - 12 bytes: TIdThreadSafeInteger x 1
>21 - 36 bytes: TIdCriticalSection x 2, TBrush x 1, TFont x 1, TPen x 1, Unknown x 2
>53 - 68 bytes: TBitmap x 1, Unknown x 1
>85 - 100 bytes: TBitmapCanvas x 1
>101 - 116 bytes: TBitmapImage x 1
>
>
>I think all of them are related to VCL core

Not really - the first two are  Indy for certain the other three probably the same. The TBitmap etc confuse me since you say you're doing nothing with graphics - something is!

To explain a little about a memory leak. Just because the item being leaked is a core VCL construct (eg TBitmap) it doesn't mean that its the VCL that's leaking. All that it means is that these things haven't been freed properly by whatever created them.

If the leaks and problems are being caused by Indy then you have two real options 1) report it to whoever is responsible for Indy these days then sit and hope that someone will patch it 2) switch to another product (eg Synapse)

Unless Indy has improved dramatically from when I tried to use it debugging it yourself is not something I'd recommend.

I know a lot of people do use Indy very happily and it may be something that you've done but without code to review no one will be able to say. As you might have guessed from my comments I can't help with Indy - I haven't used it since D4.

Roy
0
Roy
10/23/2013 12:09:20 PM
> {quote:title=Roy Lambert wrote:}{quote}
> daniel
> 
> >After some further tests, i could fix a few leaks in my app. Now the only leaks remaining are these below :
> >
> >5 - 12 bytes: TIdThreadSafeInteger x 1
> >21 - 36 bytes: TIdCriticalSection x 2, TBrush x 1, TFont x 1, TPen x 1, Unknown x 2
> >53 - 68 bytes: TBitmap x 1, Unknown x 1
> >85 - 100 bytes: TBitmapCanvas x 1
> >101 - 116 bytes: TBitmapImage x 1
> >
> >
> >I think all of them are related to VCL core
> 
> Not really - the first two are  Indy for certain the other three probably the same. The TBitmap etc confuse me since you say you're doing nothing with graphics - something is!
> 
> To explain a little about a memory leak. Just because the item being leaked is a core VCL construct (eg TBitmap) it doesn't mean that its the VCL that's leaking. All that it means is that these things haven't been freed properly by whatever created them.
> 
> If the leaks and problems are being caused by Indy then you have two real options 1) report it to whoever is responsible for Indy these days then sit and hope that someone will patch it 2) switch to another product (eg Synapse)
> 
> Unless Indy has improved dramatically from when I tried to use it debugging it yourself is not something I'd recommend.
> 
> I know a lot of people do use Indy very happily and it may be something that you've done but without code to review no one will be able to say. As you might have guessed from my comments I can't help with Indy - I haven't used it since D4.
> 

I will check Synapse, problem is we have a lot of apps using Indy componentes, would be a pain to refactor all...

About graphics, i use an Imagelist with some icons to fill the mainmenu and some buttons, really not fancy, very simple...

And these 2 Indy leaks i don't understand because even if i only open and close the app , witthout doing ANY connections or create Indy componentes, the leaks are reported.It seems 
Indy create components by itself only including its units on 'uses' clause ?


> Roy
0
daniel
10/23/2013 12:40:51 PM
daniel

>I will check Synapse, problem is we have a lot of apps using Indy componentes, would be a pain to refactor all...

In that case its worth trying to find where the problem is coming from

>About graphics, i use an Imagelist with some icons to fill the mainmenu and some buttons, really not fancy, very simple...
>
>And these 2 Indy leaks i don't understand because even if i only open and close the app , witthout doing ANY connections or create Indy componentes, the leaks are reported.It seems
>Indy create components by itself only including its units on 'uses' clause ?

I'm into wild guess time here - its probably from an initialization clause somewhere that isn't handled correctly in a finalization clause or where no such clause exists.

I've just searched the old posts I have stored locally and found this one from about three years ago

*************************************************************************************************************************

Stephen


You'll find this error has been reported on many newsgroups. Here's a response from the MadExcept one

------------------------------------------------------------------------------------------------
EOutOfResources seem to be incorrectly used here.
The RTL internally uses EOutOfResources whenever
any GDI function fails. That's stupid, if you ask
me.

What happened according to the bug report is that
one of the GDI API calls in Graphics.CopyBitmap
failed with the GetLastError message:

"Overlapped I/O operation is in progress."

That's all I can say here. If you get this problem
a lot, try compiling your exe with debug DCUs.
Then you'll get line numbers for Graphics.pas.
That should help you finding the exact line which
failed.
------------------------------------------------------------------------------------------------

This in response to an email of mine to another TMS user (I'm also a sufferer)

------------------------------------------------------------------------------------------------
We did(and still do) have these problems:-( It seems like some drivers for some graphic cards does not like TMS components. We have chosen to "ignore" the problem since we are converting to C# and WPF...

I'm sorry, I know this wasn't the answer you where hoping for:-)
------------------------------------------------------------------------------------------------

or from the e.p.d.thirtparty
------------------------------------------------------------------------------------------------
In further testing I expanded up the size of my form to match the size of the webpage.
Now when the Tbitmap.height gets set (to same height as webpage) I get an EOutOfResources Error
In my example height is 20097 and width is 1000.
So it is a memory issue with larger bitmaps.
Anyone have suggestion on how to work around this?
My next plan is to split up the bitmap into two bitmaps for the top and bottom of the web page.
Then join them up and finally convert to jpeg
Will update here if this solves it
------------------------------------------------------------------------------------------------

Never saw an update showing a solution. There are other posts but here's a bit of a response from Peter Below to one of them

------------------------------------------------------------------------------------------------
This was originally intended as an exception that is raised if a GDI
function fails because the system has run out of  GDI handles (for
things like brushes, pens, fonts, bitmaps, hDCs, for instance). This
used to happen mostly on Win9x systems, which have a very limited
supply of these (internal limits inherited from Win16 times) and the
typical cause was an application (not necessarily the one reporting the
error!) using too many of these resources or not returning them to the
OS properly when they are no longer needed.

While Win NT platforms still have limits in this area they are way
higher and it is unlikely that a program will run into them. But GDI
functions may fail for other reasons (e.g. because they are handled an
invalid handle for a GDI resource), and the VCL will then raise an
EOutOfResources error as well, since it cannot determine why the
function failed. Since the error is connected to GDI it usually crops
up in drawing code or when you are working with bitmaps in memory
(especially large bitmaps...).
------------------------------------------------------------------------------------------------

None of the above is much help to you, but if you do find out a solution please please let us know.

*************************************************************************************************************************

You may be able to track down the thread - the poster was Stephen Boyd the subject EOutOfResources error

One thing I suggested back then was that it might be down to Windows memory fragmentation - do you create and free objects a lot in the app?

Roy Lambert
0
Roy
10/23/2013 1:44:19 PM
Good news : I was able to track and solve the TBitmap related leaks : it was caused by a TFlatSpeedButton component i use in my app. After some fixes in source code these leak are solved.

I have only 2 leaks remaing :

5 - 12 bytes: TIdThreadSafeInteger x 1
21 - 36 bytes: TIdCriticalSection x 2

After some search i've found these are well know Indy leaks and i don't think they are what cause my app exception. I will run the app now (after solved the other leaks) and see what happens, i post the results here.

Thanks everybody who shared information ;)
0
daniel
10/23/2013 4:06:50 PM
daniel wrote:

> I have only 2 leaks remaing :
> 
> 5 - 12 bytes: TIdThreadSafeInteger x 1
> 21 - 36 bytes: TIdCriticalSection x 2
>
> After some search i've found these are well know Indy leaks and i
> don't think they are what cause my app exception.

No, they are not.  On the other hand, they should not have appeared in the 
leak report in the first place, as Indy registers them as known leaks via 
FastMM's RegisterExpectedMemoryLeak() function.  Which means your version 
of Indy was not compiled with the REGISTER_EXPECTED_MEMORY_LEAK define enabled, 
which should be enabled by default if you are using D2006 or later, or if 
you have USE_FASTMM4 defined on earlier versions.

--
Remy Lebeau (TeamB)
0
Remy
10/23/2013 4:59:51 PM
Roy wrote:

> Not really - the first two are  Indy for certain the other three
> probably the same.

Only the first two are related to Indy (all Indy classes are prefixed with 
TId...).  The other leaks are not related to Indy.

> If the leaks and problems are being caused by Indy then you have
> two real options 1) report it to whoever is responsible for Indy these
> days

That would be me.  And the two Indy leaks are actually intentional, and they 
are registered with FastMM to avoid being reported as leaks (which means 
Daniel's version of Indy is probably an old version that was not compiled 
to register expected leaks).

> Unless Indy has improved dramatically from when I tried to use
> it debugging it yourself is not something I'd recommend.
<snip>
> I haven't used it since D4.

Indy has changed dramatically since those days.  D4 is not supported anymore, 
but D5 still is.

--
Remy Lebeau (TeamB)
0
Remy
10/23/2013 5:05:09 PM
daniel wrote:

> And these 2 Indy leaks i don't understand because even if i only open
> and close the app , witthout doing ANY connections or create Indy
> componentes, the leaks are reported.

They are global objects created at app startup, specifically in the initialization 
sections of the IdThread and IdStack units.

> It seems Indy create components by itself only including its units on
> 'uses' clause ?

Indy does create some global classes, not components.

The TIdThreadSafeInteger is a global counter used in the IdThread unit by 
the TIdThread.WaitAllThreadsTerminated() function.  TIdThreadSafeInteger 
uses TIdCriticalSection internally, so when the TIdThreadSafeInteger is leaked, 
so is its internal TIdCriticalSection.

The other TIdCriticalSection is used in the IdStack unit to protect the creation 
and destruction of Indy's global "GStack" object, which services all socket 
API access throughout Indy.

--
Remy Lebeau (TeamB)
0
Remy
10/23/2013 5:10:48 PM
Roy wrote:

> I'm into wild guess time here - its probably from an initialization
> clause somewhere that isn't handled correctly in a finalization
> clause or where no such clause exists.

Actully, it is handled correctly, and is leaking intentionally:

IdThread.pas:

{code}
initialization
  ...
  GThreadCount := TIdThreadSafeInteger.Create;
  {$IFNDEF FREE_ON_FINAL}
    {$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
  IndyRegisterExpectedMemoryLeak(GThreadCount);
  IndyRegisterExpectedMemoryLeak(TIdThreadSafeIntegerAccess(GThreadCount).FCriticalSection);
    {$ENDIF}
  {$ENDIF}
finalization
  ...
  {$IFDEF FREE_ON_FINAL}
  //only enable this if you know your code exits thread-clean
  FreeAndNil(GThreadCount);
  {$ENDIF}
{code}

IdStack.pas:

{code}
initialization
  ...
  GStackCriticalSection := TIdCriticalSection.Create;
  {$IFNDEF DOTNET}
    {$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
  IndyRegisterExpectedMemoryLeak(GStackCriticalSection);
    {$ENDIF}
  {$ENDIF}
finalization
  // Dont Free. If shutdown is from another Init section, it can cause GPF 
when stack
  // tries to access it. App will kill it off anyways, so just let it leak
  {$IFDEF FREE_ON_FINAL}
  FreeAndNil(GStackCriticalSection);
  {$ENDIF}
{code}

--
Remy Lebeau (TeamB)
0
Remy
10/23/2013 5:13:03 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> daniel wrote:
> 
> > I have only 2 leaks remaing :
> > 
> > 5 - 12 bytes: TIdThreadSafeInteger x 1
> > 21 - 36 bytes: TIdCriticalSection x 2
> >
> > After some search i've found these are well know Indy leaks and i
> > don't think they are what cause my app exception.
> 
> No, they are not.  On the other hand, they should not have appeared in the 
> leak report in the first place, as Indy registers them as known leaks via 
> FastMM's RegisterExpectedMemoryLeak() function.  Which means your version 
> of Indy was not compiled with the REGISTER_EXPECTED_MEMORY_LEAK define enabled, 
> which should be enabled by default if you are using D2006 or later, or if 
> you have USE_FASTMM4 defined on earlier versions.

Remy,

I've downloaded the most recent version of Indy, uninstalled mine and tried to install the new one following the instructions (running FULLD_2007.BAT). Unfortunatelly it does not work, here is the command line error log :

Start
****************
 Compile System
****************
CodeGear Delphi for Win32 compiler version 18.5
Copyright (c) 1983,2007 CodeGear

IndySystem110.dpk(1) 
IndySystem110.dpk(26) 
IndySystem110.dpk(26) 
IndySystem110.dpk(26) 
IdAntiFreezeBase.pas(1) 
IdCompilerDefines.inc(460) 
IdCompilerDefines.inc(972) 
IdCompilerDefines.inc(1388) 

IdBaseComponent.pas(1) 
IdCompilerDefines.inc(439) 
IdCompilerDefines.inc(951) 
IdCompilerDefines.inc(1388) 

IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(77) 
IdBaseComponent.pas(92) 
IdBaseComponent.pas(149) 
IdGlobal.pas(1)          
IdGlobal.pas(512) 
IdCompilerDefines.inc(511) 
IdCompilerDefines.inc(1023) 
IdCompilerDefines.inc(1388) 

IdGlobal.pas(535) 
IdGlobal.pas(538) 
IdGlobal.pas(539) 
IdGlobal.pas(539) 
IdGlobal.pas(556) 
IdException.pas(1) 
IdCompilerDefines.inc(468) 
IdCompilerDefines.inc(980) 
IdCompilerDefines.inc(1388) 

IdException.pas(50) 
IdException.pas(116) 

IdGlobal.pas(558) 
IdVers.inc(18)    

IdGlobal.pas(644) 
IdGlobal.pas(1156) 
IdGlobal.pas(1646) 
IdGlobal.pas(1646) 
IdGlobal.pas(1649) 
IdResourceStrings.pas(1) 
IdResourceStrings.pas(128) 

IdGlobal.pas(1650) 
IdStream.pas(1)    
IdCompilerDefines.inc(490) 
IdCompilerDefines.inc(1002) 
IdCompilerDefines.inc(1388) 

IdStreamVCL.pas(1) 
IdCompilerDefines.inc(490) 
IdCompilerDefines.inc(1002) 
IdCompilerDefines.inc(1388) 

IdStreamVCL.pas(27) 
IdStreamVCL.pas(29) 
IdStreamVCL.pas(119) 

IdStream.pas(32) 
IdStream.pas(43) 

IdGlobal.pas(1654) 
IdGlobal.pas(1667) 
IdGlobal.pas(1668) 
IdGlobal.pas(2180) 
IdGlobal.pas(2692) 
IdGlobal.pas(3204) 
IdGlobal.pas(3716) 
IdGlobal.pas(4228) 
IdGlobal.pas(4740) 
IdGlobal.pas(5252) 
IdGlobal.pas(5764) 
IdGlobal.pas(6276) 
IdGlobal.pas(6788) 
IdGlobal.pas(7300) 
IdGlobal.pas(7812) 
IdGlobal.pas(8296) 

IdBaseComponent.pas(171) 
IdBaseComponent.pas(322) 

IdAntiFreezeBase.pas(58) 
IdAntiFreezeBase.pas(117) 
IdAntiFreezeBase.pas(118) 
IdAntiFreezeBase.pas(119) 
IdAntiFreezeBase.pas(123) 
IdAntiFreezeBase.pas(149) 
IdAntiFreezeBase.pas(179) 

IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IdCTypes.pas(1)       
IdCompilerDefines.inc(508) 
IdCompilerDefines.inc(1020) 
IdCompilerDefines.inc(1388) 

IdCTypes.pas(148) 

IndySystem110.dpk(43) 
IdComponent.pas(1)    
IdCompilerDefines.inc(451) 
IdCompilerDefines.inc(963) 
IdCompilerDefines.inc(1388) 

IdComponent.pas(68) 
IdComponent.pas(68) 
IdComponent.pas(68) 
IdComponent.pas(69) 
IdStack.pas(1)      
IdCompilerDefines.inc(374) 
IdCompilerDefines.inc(886) 
IdCompilerDefines.inc(1388) 

IdStack.pas(143) 
IdStack.pas(143) 
IdStackConsts.pas(1) 
IdCompilerDefines.inc(440) 
IdCompilerDefines.inc(952) 
IdCompilerDefines.inc(1388) 

IdWship6.pas(1) 
IdCompilerDefines.inc(478) 
IdCompilerDefines.inc(990) 
IdCompilerDefines.inc(1388) 

IdWship6.pas(66) 
IdWship6.pas(67) 
IdWinsock2.pas(1) 
IdCompilerDefines.inc(373) 
IdCompilerDefines.inc(885) 
IdCompilerDefines.inc(1388) 

IdWinsock2.pas(149) 
IdWinsock2.pas(185) 
IdWinsock2.pas(185) 
IdWinsock2.pas(185) 
IdWinsock2.pas(187) 
IdWinsock2.pas(661) 
IdWinsock2.pas(1173) 
IdWinsock2.pas(1685) 
IdWinsock2.pas(2197) 
IdWinsock2.pas(2709) 
IdWinsock2.pas(3221) 
IdWinsock2.pas(3733) 
IdWinsock2.pas(4245) 
IdWinsock2.pas(4757) 
IdWinsock2.pas(5269) 
IdWinsock2.pas(5781) 
IdWinsock2.pas(5915) 
IdWinsock2.pas(6293) 
IdWinsock2.pas(6805) 
IdWinsock2.pas(7317) 
IdWinsock2.pas(7829) 
IdWinsock2.pas(8341) 
IdWinsock2.pas(8853) 
IdWinsock2.pas(8926) 

IdWship6.pas(69) 
IdWship6.pas(149) 
IdWship6.pas(424) 
IdWship6.pas(469) Warning: W1000 Symbol 'GIdIPv6FuncsAvailable' is deprecated

IdWship6.pas(661) 
IdWship6.pas(1019) Hint: H2164 Variable 'tmp' is declared but never used in 'WspiapiLegacyGetNameInfo'

IdWship6.pas(1173) 
IdWship6.pas(1221) Warning: W1000 Symbol 'GIdIPv6FuncsAvailable' is deprecated

IdWship6.pas(1229) 

IdStackConsts.pas(86) 
IdStackConsts.pas(125) 
IdStackConsts.pas(149) 
IdStackConsts.pas(661) 
IdStackConsts.pas(937) 

IdStack.pas(143) 
IdStack.pas(143) 
IdStack.pas(145) 
IdStack.pas(149) 
IdStack.pas(415) 
IdStackWindows.pas(1) 
IdCompilerDefines.inc(320) 
IdCompilerDefines.inc(832) 
IdCompilerDefines.inc(1344) 
IdCompilerDefines.inc(1388) 

IdStackWindows.pas(197) 
IdStackWindows.pas(197) 
IdStackWindows.pas(197) 
IdStackBSDBase.pas(1)   
IdCompilerDefines.inc(358) 
IdCompilerDefines.inc(870) 
IdCompilerDefines.inc(1382) 
IdCompilerDefines.inc(1388) 

IdStackBSDBase.pas(164) 
IdStackBSDBase.pas(164) 
IdStackBSDBase.pas(164) 
IdStackBSDBase.pas(164) 
IdStackBSDBase.pas(166) 
IdStackWindows.pas(197) 
IdStackWindows.pas(197) 
IdStackWindows.pas(197) 
IdStackWindows.pas(198) 
IdStackWindows.pas(199) 
IdStackWindows.pas(201) 
IdIDN.pas(1)            
IdCompilerDefines.inc(477) 
IdCompilerDefines.inc(989) 
IdCompilerDefines.inc(1388) 

IdIDN.pas(41) 
IdIDN.pas(63) 
IdIDN.pas(149) 
IdIDN.pas(205) 
IdIDN.pas(367) 

IdStackWindows.pas(330) 
IdStackWindows.pas(330) 
IdStackWindows.pas(342) 
IdStackWindows.pas(661) 
IdStackWindows.pas(1173) 
IdStackWindows.pas(1685) 
IdStackWindows.pas(2197) 
IdStackWindows.pas(2340) 

IdStackBSDBase.pas(341) 
IdStackBSDBase.pas(342) 
IdStackBSDBase.pas(346) 
IdStackBSDBase.pas(599) 

IdStack.pas(420) 
IdStack.pas(422) 
IdStack.pas(661) 
IdStack.pas(1036) 

IdComponent.pas(71) 
IdComponent.pas(149) 
IdComponent.pas(262) 

IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IdStruct.pas(1)       
IdCompilerDefines.inc(490) 
IdCompilerDefines.inc(1002) 
IdCompilerDefines.inc(1388) 

IdStruct.pas(28) 
IdStruct.pas(91) 
IdStruct.pas(149) 
IdStruct.pas(221) 

IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(43) 
IndySystem110.dpk(45) 
IndySystem110.dpk(46) 
47541 lines, 0.12 seconds, 321 bytes code, 0 bytes data.
**************
 Compile Core    
**************
CodeGear Delphi for Win32 compiler version 18.5
Copyright (c) 1983,2007 CodeGear

IndyCore110.dpk(1) 
IndyCore110.dpk(25) 
IndyCore110.dpk(25) Fatal: E2202 Required package 'IndySystem110' not found
Error!

> 
> --
> Remy Lebeau (TeamB)
0
daniel
10/23/2013 5:22:14 PM
> {quote:title=daniel costa wrote:}{quote}
> > {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> > daniel wrote:
> > 
> > > I have only 2 leaks remaing :
> > > 
> > > 5 - 12 bytes: TIdThreadSafeInteger x 1
> > > 21 - 36 bytes: TIdCriticalSection x 2
> > >
> > > After some search i've found these are well know Indy leaks and i
> > > don't think they are what cause my app exception.
> > 
> > No, they are not.  On the other hand, they should not have appeared in the 
> > leak report in the first place, as Indy registers them as known leaks via 
> > FastMM's RegisterExpectedMemoryLeak() function.  Which means your version 
> > of Indy was not compiled with the REGISTER_EXPECTED_MEMORY_LEAK define enabled, 
> > which should be enabled by default if you are using D2006 or later, or if 
> > you have USE_FASTMM4 defined on earlier versions.
> 
> Remy,
> 
> I've downloaded the most recent version of Indy, uninstalled mine and tried to install the new one following the instructions (running FULLD_2007.BAT). Unfortunatelly it does not work, here is the command >line error log :

Nevermind, i installed manually and worked. And indeed, the leaks are gone ! I will test my app and see if is there some improvment about the Out of memory exception.

Thank you very much !
0
daniel
10/23/2013 5:41:33 PM
daniel wrote:

> I've downloaded the most recent version of Indy, uninstalled mine
> and tried to install the new one following the instructions (running
> FULLD_2007.BAT). Unfortunatelly it does not work, here is the
> command line error log :
<snip>
> IndyCore110.dpk(25) Fatal: E2202 Required package 'IndySystem110'
> not found

That .BAT file creates a D11 folder above Indy's \Lib folder and puts the 
compiled files in that folder.  You likely need to add that folder to your 
OS search path, or edit the .BAT file to add that folder to the current PATH 
dynamically, eg:

{code}
....
if exist ..\D11\*.* call clean.bat ..\D11\
REM add this
if exist ..\D11\*.* then set PATH=..\D11;%PATH%
....
{code}

Or edit the statements that invoke dcc32.exe to specify the D11 folder as 
a parameter.  They are already specifying /N and /U for that purpose, but 
maybe other parameters are also needed, like /O or similar.  To be honest, 
I did not write the .BAT files, and do not do command-line compilations. 
 I prefer to compile and install Indy using the IDE instead.

--
Remy Lebeau (TeamB)
0
Remy
10/23/2013 5:44:47 PM
Daniel, I still suggest you to inspect resources of your program with
task manager: you will get good clue if some resource is growing.

Also (I don't know about modern win versions but I seen it in XP) if
some program in system creates too big device-compatible bmp other
programs can raise "out of resources" because all programs in system
use the same quite small (~16 Mb or so) GDI buffer.

-- 
Alex
0
Alex
10/24/2013 4:44:02 AM
Remy


>Indy has changed dramatically since those days.

Glad to hear it

Roy
0
Roy
10/24/2013 1:02:48 PM
Remy


>Actully, it is handled correctly, and is leaking intentionally:

I've never heard of something deliberately leaking before :)

Roy
0
Roy
10/24/2013 1:02:51 PM
After tracing and solving the memory leaks of the application, the problem seems to be solved. Thanks everybody for cooperation !
0
daniel
10/24/2013 3:26:20 PM
Reply:

Similar Artilces:

How to use a .dmp file for a system which crashes using a delphi app
Hi, I put this post here because I am not sure of the best location. I have been given a memory dump (.dmp) file by a client who thinks that a Delphi 7 application is causing their system to blue screen from time to time. Does anyone know how I can use this .dmp file to locate the problem in the delphi app? The build the client is using has debug symbols turned on. I have downloaded Microsoft Debugging Tools for windows and have dupmchk.exe (and kd.exe) but I would really appreciate some help with how these or any other useful tools should be used? Many thanks Ben > I have down...

System.IO Exception
Hi, I've created a page where a user can upload a zip file of images and display the list, the HTML list includes a thumbnail of the image eg: "<img src="thumb.aspx?p=blah">". To keep the thumbnail images seperate to the working directories for the unzipping/storage processes; A folder "temp" is used within the users directory. Whenever the thumb.aspx page is used, the image is copied from the "unzipped" directory to the "temp" directory, and the thumb is created using the "temp" directory as the source.The problem is on irregular occasions after debugging a system.IO.excepti...

Using resources with Exceptions
I am looking for the best way to handle exception messages in a multi-language site.  I understand how resources work and I can get the message of the exception from the resource file without a problem.  The problem I am having is the way the language is choosen for the exception message.  From my understanding, exceptions in general are not for the general user to see.  Not even the exception message.  No user out there should get and error saying "Object reference not set to an instance of an object." or a foreign key constraint error from the database.  To me...

To use or not to use Delphi
Sadly, it seems to me that there is a sort of race between the two threads, for and against using Delphi in new projects, with more or less the same users posting in both threads. Arguments are fiercely debated in both camps. Borland had their own vision. As a community, now that Delphi has changed ownership I believe we should try to be more consistent, more clear, and more articulate in what we expect from Embercadero in terms of Delphi. We can contribute to keeping Delphi alive and moving in the right direction. "Laurent Cocea" schrieb: > Sadly, it seems to me that there ...

Delete Organization using Web Based Hosting webservice method throws exception: "The specified resource instance is still being used"
Step to reproduce exception: - Create an customer org inside a reseller - Create a distribution list (GLOBAL DISTRIBUTION) - Delete the distribution list - Use the DeleteOrganization of the Web Based Hosting namespace to delete the organization and get the exception: "The specified resource instance is still being used". However, if I use the DeleteOrganization of the Managed Active Directory namespace, it WORKS perfectly. Hieu NguyenAllstream ACS...

ZAP using up system resources
Can someone tell me what the impact of running ZAP on my system would be. I have a PIII 800 with 256 megs of memory. I have a Linky in place and am debating on whether or not I should put ZAP on as a software firewall. If I do decide to download it what is a good default level of security. Thanks in advance for any help. [cross-posted to grc.security.software for topic relevance] Hello Scott, The effects would be negligable. On my crappy old w95 P1/233 32meg RAM, I never notice it. A quick check reveals that ZAP running in the background averages 2.13% of total CPU usage. ...

Firefox uses more resource on 64bit system
Name: Hung Truong Email: ngochung256atyahoodotcom Product: Firefox Summary: Firefox uses more resource on 64bit system Comments: Hi Dev Team, The first thing I want to say that you guys and your product are wonderful. I like firefor before you guy release version 2.0. And now, I still like to use FF. But I don't why, sice I use 64bits system (CPU: P8600, 4GB RAM), but it looks like FF use too much resource: about 50% of CPU, and >150MB of memory on my system. I wonder the reason is I ran 32bit application on 64bit system, or another reason? Thanks, Hung Truong ...

VCL using BMP resource example
For the last few days I been trying to figure out exactly how to load a resource file containg a bmp file to be used for a component. I am using a program called XN Resource Editor to create the DCR file and using it for the Icon and BMP canvas . However I have not been able to get the code to load the bmp onto the canvas Does nayone have a snipit of code that will do that I can use to build off of thanks Donald Dahlman wrote: > For the last few days I been trying to figure out exactly how to load > a resource file containg a bmp file to be used for a component. Your t...

help image layout text using System.Drawing.Imaging; using System.Drawing;
using System.Drawing; using System.Drawing.Imaging;public partial class _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) {Image img1 = Image.FromFile(Server.MapPath("1.bmp"), true); Image img2 = Image.FromFile(Server.MapPath("2.bmp"), true);Bitmap img = new Bitmap(300, 300, PixelFormat.Format24bppRgb);Graphics g = Graphics.FromImage(img); g.DrawImageUnscaled(img1, 0, 0, img1.Width, img1.Height); g.DrawImage(img2, 100, 100, 50, 50);Font font = new Font("Arial", 20); SolidBrush brush = new SolidBrush(Color.Black);st...

The requested resource is in use. (Exception from HRESULT: 0x800700AA)
Hi, I have a thin windows client in the front end that talks to ASP.NET web services on the backend. Currently this application is going under load testing. When we have 2-3 users simultaneous using the application the users are complaining that they are seeing this error often. This error is not reproducable as it happen randomly. Can anybody who has seen this error or delt with it suggest what could be wrong. On the IIS the ASP.NET site is on it own AppPool. I have used the default IIS settings for the AppPool. The server is a single-core windows 2003 web edition with 1/2 a gig of RAM on...

Spreadsheet component for use in Delphi VCL 2010
Good day I have been using the Flexcel component for reading and writing Excel spreadsheets in my Delphi VCL projects for some while and have been very happy. Unfortunately, though, a version for use with Excel 2007 format files (.XLSX) has been promised for years now but just never arrives and I have reached a stage where I just have to update some of my software. Can any body suggest alternatives and comment on their experience with these? I have no objection to buying a component although all my programs are for academic use by myself and colleagues/friends so cheaper would...

What systems using "\r\n" and what systems using "\n" etc ?
------=_NextPart_000_002B_01C353EC.615A7010 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Is that any module can help to detect what is the right new line = declaration for the=20 current system ? Somwhat if the system is detected be Windows, the = newline declaration is "\n", for *nix, is "\r\n" , for Mac and etc. Thanks in advise ------=_NextPart_000_002B_01C353EC.615A7010-- In article <002e01c353a9$54133830$3210a8c0@ORG>, LI NGOK LAM wrote: > ------=_NextPart_000_002B_01C353EC.615A7010 &...

The requested resource is in use. (Exception from HRESULT: 0x800700AA)
Hi, I have a thin windows client (using windows.forms) in the front end that talks to ASP.NET web services on the backend. Currently this application is going under load testing. When we have 2-3 users simultaneous using the application the users are complaining that they are seeing this error often. This error is not reproducable as it happen randomly. Can anybody who has seen this error or delt with it suggest what could be wrong. On the IIS the ASP.NET site is on it own AppPool. I have used the default IIS settings for the AppPool. The server is a single-core windows 2003 web editi...

Resource leaks when using VCL DLL from .NET
Hi all, I have a DLL that's written in C++Builder (2006), and I'm invoking a single function in the DLL from a .NET application. The problem is, when I close the .NET application (and the DLL gets detached from it) I get a CodeGuard message saying that it detected resource leaks (and I see the leaks in the CodeGuard log file). The leaks are 200 bytes allocated by SysGetMem, then several instances of 16 bytes allocated by 'new'. Now, I'm 99% certain that I'm freeing all the memory I'm using in the DLL function. In fact, I tried building a dummy DLL with an ...

Web resources about - Out of system resources exception - embarcadero.delphi.vcl.using

Minister of Natural Resources (Canada) - Wikipedia, the free encyclopedia
The Minister of Natural Resources ( French : Ministre des Ressources naturelles ) is the Minister of the Crown in the Canadian Cabinet who is ...

European stocks rally on resource shares
European stocks rose to a two-week high as miners and oil shares surged. BHP Billiton gained 6.8pc.

need2know: ASX set to lift on resources
Santa Claus appears set to lift local shares ahead of Christmas.

ASX falls amid resource stocks meltdown
Poor overseas leads, weak economic news from China and crumbling commodity prices created a perfect storm for Australian mining and energy stocks ...

Multinational oil and gas giants paying no petroleum resource rent tax
... petrol and gas companies operating in Australia notched sales of nearly $30 billion last year but did not pay a cent in petroleum resource rent ...

SMBs lack the resources to protect themselves from cyber attacks
... is an issue too, with 60 percent of respondents believing their organization is more vulnerable to attacks because they don't have the resources ...

Introducing the new Calendar Resource API
... help Apps administrators better manage their domains. To deliver even more granular control, today we are announcing the new Calendar Resource ...

Turing Pharmaceuticals AG Announces Restructuring to Better Align Resources with the Company’s priorities ...
Turing Pharmaceuticals, AG a privately held biopharmaceutical company focused on commercializing and developing innovative treatments for rare ...

Anthony Mackie Is Ready for "Civil War" - And Chadwick Boseman's Black Panther - Comic Book Resources ...
Anthony Mackie Is Ready for "Civil War" - And Chadwick Boseman's Black Panther - The actor behind the Falcon tells CBR the "Captain America" ...

Installed distributed energy resources capacity expected to reach 530.7GW in 2024, says Navigant
Distributed energy resources (DER) penetration is increasing globally, causing a significant, and sometimes controversial, impact on the power ...

Resources last updated: 12/30/2015 12:09:53 AM