Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #5602

Re: Memory corruption problem

Subject Re: Memory corruption problem
Newsgroups comp.sys.acorn.programmer
From Alan Adams <alan@adamshome.org.uk>
Date 2018-11-17 13:10 +0000
Message-ID <03ea605857.Alan.Adams@ArmX6.adamshome.org.uk> (permalink)
References <2e86dd5757.Alan.Adams@ArmX6.adamshome.org.uk> <d3ad8c64-f34e-4187-8f6c-c6cccf0b8b0f@googlegroups.com> <2c745c5857.Alan.Adams@ArmX6.adamshome.org.uk>
Organization Orpheus Internet Services

Show all headers | View raw


In message <2c745c5857.Alan.Adams@ArmX6.adamshome.org.uk>
          Alan Adams <alan@adamshome.org.uk> wrote:

> In message <d3ad8c64-f34e-4187-8f6c-c6cccf0b8b0f@googlegroups.com>
>           David Buck <dbuckhome@gmail.com> wrote:

>> On Friday, 16 November 2018 13:15:20 UTC, Alan Adams  wrote:
>>> Hi
>>> 
>>> I have a huge BASIC project which uses TCPIP networking. I am
>>> currently making some changes, and have hit a snag. Something seems to
>>> be corrupting system memory. The symptoms are that at apparently
>>> random times I get "file has been closed or handle is invalid", mainly
>>> from my programs but occasionally also from Messenger. Occasionally
>>> also the fonts get changed on the desktop, and shutdown produces "font
>>> not found".
>>> 
>>> When I get "invalid handle" the handle value is still the one previous
>>> writes to the file have used.
>>> 
>>> Hermes also occasionally reports a "network problem" which requires a
>>> reboot. While this might be due to runaway socket allocation,
>>> exhausting the supply, it also might indicate corruption of the areas
>>> pointed to, in the same way I suspect the areas referenced by file
>>> handles are being altered.
>>> 
>>> It would help if I knew what areas of memory to look at after the
>>> event - the things overwritten there (if that is indeed what is
>>> happening) may tell me what part of my code is getting it wrong.
>>> 
>>> --
>>> Alan Adams, from Northamptonshire
>>> alan@adamshome.org.uk
>>> http://www.nckc.org.uk/

>> Sounds like a classic CLOSE#0 occurring. This used to be my downfall,
>> and caused the desktop font to change also. Make sure a handle is
>> valid before closing it, some thing like...

>> If handle%>0 THEN CLOSE#handle%

>> HTH

> Thanks. That could be it.

> I think a PROCclosefile is required, and change all the closes to use
> it.

That was it. The following helped track down the problem:

DEF PROCclosefile(RETURN H%)
  IF (DEBUG%AND(1<<21)) AND (H%=0) THEN
    *REPORT \R WL: closefile: HANDLE IS ZERO H%
    *REPORTSTACK
  ENDIF
  IF H%<>0 THEN CLOSE#H%:H%=0
ENDPROC

Luckily my guess at the area to change to use this was the area 
causing the problem - it was some of the other debugging code.




-- 
Alan Adams, from Northamptonshire
alan@adamshome.org.uk
http://www.nckc.org.uk/

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Memory corruption problem Alan Adams <alan@adamshome.org.uk> - 2018-11-16 13:15 +0000
  Re: Memory corruption problem Martin <News03@avisoft.f9.co.uk> - 2018-11-16 15:21 +0000
    Re: Memory corruption problem Alan Adams <alan@adamshome.org.uk> - 2018-11-16 15:53 +0000
      Re: Memory corruption problem Martin <News03@avisoft.f9.co.uk> - 2018-11-16 20:04 +0000
        Re: Memory corruption problem Alan Adams <alan@adamshome.org.uk> - 2018-11-16 22:38 +0000
          Re: Memory corruption problem Martin <News03@avisoft.f9.co.uk> - 2018-11-16 23:46 +0000
  Re: Memory corruption problem David Buck <dbuckhome@gmail.com> - 2018-11-16 23:15 -0800
    Re: Memory corruption problem Alan Adams <alan@adamshome.org.uk> - 2018-11-17 12:21 +0000
      Re: Memory corruption problem Alan Adams <alan@adamshome.org.uk> - 2018-11-17 13:10 +0000
        Re: Memory corruption problem Martin <News03@avisoft.f9.co.uk> - 2018-11-17 19:01 +0000
          Re: Memory corruption problem Alan Adams <alan@adamshome.org.uk> - 2018-11-17 21:04 +0000
        Re: Memory corruption problem Erik G <noreply123@xs4all.nl> - 2018-11-24 20:17 +0100
    Re: Memory corruption problem "John Williams (News)" <UCEbin@tiscali.co.uk> - 2018-11-17 12:26 +0000
    Re: Memory corruption problem David Higton <dave@davehigton.me.uk> - 2018-11-17 20:59 +0000

csiph-web