Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Modula 3 > Re: Stack Check...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 135 of 149
Post > Topic >>

Re: Stack Checking in modula3

by Olaf Wagner <wagner@[EMAIL PROTECTED] > Oct 9, 2006 at 08:13 AM

demoitem wrote:
> Hi,
> 
>  I was running down a problem with network objects producing a segv on
> my linux box and finally discovered that the recursive pickler would
> overflow the stack on a linked list of 25 or so items
> which was do***ented in the pickle source.  On trying to reproduce the
> problem I discovered that it only occurs in a thread (using the
> threadposix model) which is not the main.  The main thread will
> allocate as much stack as you like until you run out of virtual memory.

Then M3 cannot be blamed, as it simply uses the threads provided by the
operating system environment in this case.

>   I was wondering what options there are to give better diagnostics of
> stack overflow than simple segv's in an m3 program. Presumably the
> pthread model will duplicate the main thread model in allocation of
> more stack until vm exhaustion.  At that point it would be nice to know
> it was a stack problem and hence a probably recursive programming fault
> than tracing through the nightmare of   possible library bugs.

Usually a thread implementation should allocate a guard page at the end
of a thread's stack and protect it via mprotect or an equivalent, so
that the hardware/operating system delivers a signal on a write attempt.
IIRC this was done by the user level thread implementation of M3. This
signal can then be mapped to a meaningful runtime exception. I'm not
sure if this really works in CM3 as I've never tested it.

Olaf
 




 3 Posts in Topic:
Stack Checking in modula3
"demoitem" <  2006-09-25 04:18:35 
Re: Stack Checking in modula3
Olaf Wagner <wagner@[E  2006-10-09 08:13:54 
Re: Stack Checking in modula3
Riley <riley@[EMAIL PR  2006-10-09 15:39:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:04:18 CDT 2008.