From 37b2c8bbd7bbab7a2c46da0f74a2ddcf388e96e9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 9 Aug 2008 16:08:04 +0000 Subject: [PATCH] 2008-08-09 18:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/extrap.c * use static buffer for signal alternative stack so it will not have to be deallocated for clean application exit --- harbour/ChangeLog | 5 +++++ harbour/source/vm/extrap.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a7cc1da182..d1a15e6e03 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-08-09 18:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/extrap.c + * use static buffer for signal alternative stack so it will not + have to be deallocated for clean application exit + 2008-08-09 18:00 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * make_gnu_os2.cmd * Minor formatting. diff --git a/harbour/source/vm/extrap.c b/harbour/source/vm/extrap.c index 16d09b4d71..a474d2c179 100644 --- a/harbour/source/vm/extrap.c +++ b/harbour/source/vm/extrap.c @@ -80,6 +80,10 @@ # endif #endif +#if defined( HB_SIGNAL_EXCEPTION_HANDLER ) + static BYTE * s_signal_stack[ SIGSTKSZ ]; +#endif + #if defined(HB_OS_WIN_32) && !defined(HB_WINCE) LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInfo ) @@ -323,7 +327,7 @@ void hb_vmSetExceptionHandler( void ) #elif defined( HB_SIGNAL_EXCEPTION_HANDLER ) { stack_t ss; - ss.ss_sp = ( void * ) hb_xgrab( SIGSTKSZ ); + ss.ss_sp = ( void * ) s_signal_stack; ss.ss_size = SIGSTKSZ; ss.ss_flags = 0; /* set alternative stack for SIGSEGV executed on stack overflow */ @@ -358,6 +362,10 @@ void hb_vmUnsetExceptionHandler( void ) } #elif defined( HB_SIGNAL_EXCEPTION_HANDLER ) { + /* we are using static buffer for alternative stack so we do not + * have to deallocate it to free the memory on application exit + */ +#if 0 stack_t ss, oss; ss.ss_sp = NULL; ss.ss_size = SIGSTKSZ; @@ -366,8 +374,9 @@ void hb_vmUnsetExceptionHandler( void ) if( sigaltstack( &ss, &oss ) == 0 ) { if( oss.ss_sp && SS_DISABLE ) - hb_xfree( oss.ss_sp ); + free( oss.ss_sp ); } +#endif } #endif }