For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > How to resolve Stock Overflow issue









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to resolve Stock Overflow issue
Prakash

2005-05-30, 4:01 pm

Hi Friends,

I have developed the application compatible for Windows 2000, XP and
98. While running the application in windows 98, i have tried to resize
the window. At that time i got the exception like "Stock Overflow". But
i am not get the error in Windows 2000 and XP.

Please help me to resolve the issue in Win98.

Regards,
Prakash.

Igor Tandetnik

2005-05-30, 4:01 pm

"Prakash" <p.gnanaprakash@gmail.com> wrote in message
news:1117457690.999347.138290@f14g2000cwb.googlegroups.com
> I have developed the application compatible for Windows 2000, XP and
> 98. While running the application in windows 98, i have tried to
> resize the window. At that time i got the exception like "Stock
> Overflow". But i am not get the error in Windows 2000 and XP.


It's "Stack overflow". Somehow you got yourself into an infinite
recursion. E.g. this would happen if you handle WM_SETWINDOWPOS or
similar message and resize the window in response to it - which of
course would again trigger the same message, which would cause you to
resize the window, which triggeres the message, and so on.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Prakash

2005-05-31, 9:14 am

Hi Friends,

I have resolved this issue. I got the exception because of recursive
call in OnPaint and OnEraseBackground.. I have made redraw window calls
in OnEraseBackground function.. so it made again and again call in
OnPaint... so after removing the redrawwindow call in onerasebackground
function, my program works well.

Regards,
Prakash.

Igor Tandetnik wrote:
> "Prakash" <p.gnanaprakash@gmail.com> wrote in message
> news:1117457690.999347.138290@f14g2000cwb.googlegroups.com
>
> It's "Stack overflow". Somehow you got yourself into an infinite
> recursion. E.g. this would happen if you handle WM_SETWINDOWPOS or
> similar message and resize the window in response to it - which of
> course would again trigger the same message, which would cause you to
> resize the window, which triggeres the message, and so on.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925


David W. Poole, Jr.

2005-06-01, 4:03 pm

On 30 May 2005 05:54:51 -0700, "Prakash" <p.gnanaprakash@gmail.com>
was understood to have stated the following:

>Hi Friends,
>
>I have developed the application compatible for Windows 2000, XP and
>98. While running the application in windows 98, i have tried to resize
>the window. At that time i got the exception like "Stock Overflow". But
>i am not get the error in Windows 2000 and XP.
>
>Please help me to resolve the issue in Win98.


Two major options:

1) Increase stack size; this should be a linker option.

2) Redesign your algorithm/implementation to use less stack space.
Many approaches can be taken here; my favorite is to shift from stack
allocations to heap allocations.


Xeton2001IsAFlamingIdiot.dwpj65@spamgourmet.com

2005-06-02, 4:02 am

Igor Tandetnik wrote:
> "Prakash" <p.gnanaprakash@gmail.com> wrote in message
> news:1117457690.999347.138290@f14g2000cwb.googlegroups.com
>
> It's "Stack overflow". Somehow you got yourself into an infinite
> recursion. E.g. this would happen if you handle WM_SETWINDOWPOS or
> similar message and resize the window in response to it - which of
> course would again trigger the same message, which would cause you to
> resize the window, which triggeres the message, and so on.


If it's infinite recursion, why does the recursion terminate under 2000
& XP, but not on 98?

Igor Tandetnik

2005-06-02, 4:02 am

<Xeton2001IsAFlamingIdiot.dwpj65@spamgourmet.com> wrote in message
news:1117676829.758464.219790@g47g2000cwa.googlegroups.com
> Igor Tandetnik wrote:
>
> If it's infinite recursion, why does the recursion terminate under
> 2000 & XP, but not on 98?


For example, a sequence of window messages might be slightly different,
so that the problem manifests itself under one OS version but not
another. Without testing the actual code, it is hard to tell.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Xeton2001IsAFlamingIdiot.dwpj65@spamgourmet.com

2005-06-02, 4:02 am



Igor Tandetnik wrote:
> <Xeton2001IsAFlamingIdiot.dwpj65@spamgourmet.com> wrote in message
> news:1117676829.758464.219790@g47g2000cwa.googlegroups.com
>
> For example, a sequence of window messages might be slightly different,
> so that the problem manifests itself under one OS version but not
> another. Without testing the actual code, it is hard to tell.


Thanks for the elaboration; seems plausible to me. Great .sig, BTW.

> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com