Stack Structure and Stack Overflow for CE 
Author Message
 Stack Structure and Stack Overflow for CE

How is CE 4.1 stack implemented?

I am noticing something strange when we run our application with eVC++ in
the emulator.  Our application opens a file that a user selects and performs
data analysis on it by launching a separate process asynchronously.  If we
run our application in eVC++ with the de{*filter*} in the emulator and start
analysis, the analysis process abnormally terminates.  I started to debug
the analysis process that gets launched while our main application is
running in the de{*filter*}.  I found that the analysis process access violates
when a stack variable is trying to be initialized.  I have monitored the
stack pointer to verify we are not corrupting the stack.   When I debug to
the line before the crash, exit our main application, and execute the line
where the crash occurs then no problem.  Clearly, this problem occurs when
both processes are running in the de{*filter*}.  I have looked at the memory of
the emulator and it shows plenty of memory for programs.

Based on what I know about Windows NT, 2K, and XP you can get an ACC-VIO
when you run out of stack.  Actually you get a stack overflow exception
before you access you last stack page; however, if you choose to ignore and
you access beyond this last stack page you will get an ACC-VIO.  Could this
be what is happening in the CE emulator?  Note: I have even seen the
emulator perform a "hardware reset" because of this problem.  I have tried
increasing stack size via /F compiler switch and linker options but no luck.

Thanks.



Sat, 22 Oct 2005 17:44:31 GMT  
 Stack Structure and Stack Overflow for CE
On CE, we only have 1 page guarding the top of stack. If you skip the page,
you'll get AV if you're lucky, or you might over-write heap or even other
thread's stack if you're unlucky. It's strongly recommended that you do not
use large local variables (< 4K) under CE to prevent youself from skipping
the guard page.

    -- Bor-Ming

--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2003 Microsoft Corporation. All rights
reserved.

Quote:
> How is CE 4.1 stack implemented?

> I am noticing something strange when we run our application with eVC++ in
> the emulator.  Our application opens a file that a user selects and
performs
> data analysis on it by launching a separate process asynchronously.  If we
> run our application in eVC++ with the de{*filter*} in the emulator and start
> analysis, the analysis process abnormally terminates.  I started to debug
> the analysis process that gets launched while our main application is
> running in the de{*filter*}.  I found that the analysis process access
violates
> when a stack variable is trying to be initialized.  I have monitored the
> stack pointer to verify we are not corrupting the stack.   When I debug to
> the line before the crash, exit our main application, and execute the line
> where the crash occurs then no problem.  Clearly, this problem occurs when
> both processes are running in the de{*filter*}.  I have looked at the memory
of
> the emulator and it shows plenty of memory for programs.

> Based on what I know about Windows NT, 2K, and XP you can get an ACC-VIO
> when you run out of stack.  Actually you get a stack overflow exception
> before you access you last stack page; however, if you choose to ignore
and
> you access beyond this last stack page you will get an ACC-VIO.  Could
this
> be what is happening in the CE emulator?  Note: I have even seen the
> emulator perform a "hardware reset" because of this problem.  I have tried
> increasing stack size via /F compiler switch and linker options but no
luck.

> Thanks.



Sat, 29 Oct 2005 09:37:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Stack overflow exception

2. Stack Overflow

3. stack overflow help?

4. Stack overflow exception

5. catching c stack overflow

6. Stack Overflow in Form Width?

7. fp Stack Overflow

8. Dumb question re: stack overflow

9. stack overflow help

10. STACK OVERFLOW

11. Stack overflow

12. Stack overflow help sought

 

 
Powered by phpBB® Forum Software