Re: Strange crash
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 12, 2002
- 394 views
I have actually got a "safe" version of the memory allocation routines which I use internally. I will make it available ASAP. 13/09/2002 5:20:30 AM, Robert Craig <rds at RapidEuphoria.com> wrote: > >Matt Lewis writes: >> Have any ideas about what's causing it? Oh, I can also stop the crash by >> changing the line to >> >> rect[3] += rect[1] >> rect[4] += rect[2] > >There aren't any known bugs in the >Euphoria interpreter run-time engine for 2.3. > >The subscript statements above won't allocate any memory. >When you instead use a slice, memory might be allocated from >the heap. If the heap has been corrupted by earlier poke/poke4 etc. >statements, then a crash could happen. > >I would very carefully check all the addresses that were passed in to >your routine, and all the pokes, making sure that enough memory >has been allocated in each case, and you aren't writing out-of-bounds. >Then I would look at any pokes etc that you did before the routine >was called. Be sure to use trace(3). > >Memory corruption bugs can be a nightmare to solve. >The slightest change to your program can make the >bug appear or disappear. People end up believing >all sorts of superstitions - "the bug only happens on Tuesdays >when it's raining!". You shouldn't assume that the line it >crashes on is buggy. About all you can say is that the corruption >happened before this point. > >It's too bad that euphoria\include\safe.e can't be used with Win32Lib. >I think it would be an excellent project for someone to >adapt safe.e to work with Win32Lib's storage allocator. > >Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com > > > > --------- Cheers, Derek Parnell ICQ# 7647806