Seite 1 von 3

Memory-Fehler "PureDishelper" [Gelöst]

Verfasst: 29.05.2008 16:43
von kwai chang caine
Hallo an alle

Seit einer Stunde habe ich einen Fehler Packete zu lesen, wenn ich ein zweites Mal in zwei verschiedenen Funktionen.

Ich hatte die Idee zu versuchen, zu lesen, zweimal hintereinander zu sehen, ob der Fehler habe meine Funktion oder "PureDispHelper"

Und wenn man Kopie der gleichen Befehl zweimal hintereinander erhalte man, warum dieser Fehler Ihrer Meinung ?

Code: Alles auswählen

dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1)
dhFreeString(Result)
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1)
Invalid memory access (read error at adress 167853909)
Danke viele

Re: Memory-Fehler in der zweiten Lesung "PureDishelper&

Verfasst: 29.05.2008 17:00
von Kiffi
Hello kwai chang caine,

what kind of type is 'Area'? Really a string?

Greetings ... Kiffi

Verfasst: 29.05.2008 17:11
von kwai chang caine
Hello my good KIFFY
I wait you, like a dog wait his master, :mrgreen:
but without shaking the tail :lol:

Yes is a string, what is funny is that the first instruction that works fine :D
And at the second instruction (Two line after) they are an error with exactly the same instruction :shock:

This is the code a little more complete :

Code: Alles auswählen


Structure SessionTGC 
 Nom.s[5] 
 Adresse.l[5] 
EndStructure 

Global Dim TabSessions.SessionTGC(5) 

Procedure CreateSession() 
    
 Define Count.l 
 Define SessionEnCours.l 
 Define Name.l 
 SessionTGC = dhCreateObject("Extra.Sessions") 
 dhGetValue("%d", @Count, SessionTGC, ".count") 
  
 For Sess = 1 To Count 
  
  dhGetValue("%T", @Name, SessionTGC, ".item(%d)", Sess) 
  dhGetValue("%o", @SessionEnCours, SessionTGC, ".item(%d)", Sess) 
  TabSessions(Sess)\Nom = PeekS(Name) 
  TabSessions(Sess)\Adresse = SessionEnCours 
  dhFreeString(Name) 
  dhFreeString(SessionEnCours) 
  
 Next 
    
EndProcedure 

Procedure AdresseSession(NomSessionChoisie.s) 

 For i = 1 To 5 
  
  If UCase(Trim(TabSessions(i)\Nom)) = UCase(Trim(NomSessionChoisie)) 
   ProcedureReturn TabSessions(i)\Adresse 
  EndIf 
  
 Next 
  
 ProcedureReturn 0 
  
EndProcedure 

Define Result.l 
Define Session.l 
NomSessionChoisie.s = "A19"

CreateSession() 
Session = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 

; The Variable Result is good 

dhFreeString(Result) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 
; Error at this line 

Verfasst: 29.05.2008 17:19
von kwai chang caine
And with this is exactly the same problem :cry:
Yet the adress is the same for each time :shock:

Code: Alles auswählen

Structure SessionTGC 
 Nom.s[5] 
 Adresse.l[5] 
EndStructure 

Global Dim TabSessions.SessionTGC(5) 

Procedure CreateSession() 
    
 Define Count.l 
 Define SessionEnCours.l 
 Define Name.l 
 SessionTGC = dhCreateObject("Extra.Sessions") 
 dhGetValue("%d", @Count, SessionTGC, ".count") 
  
 For Sess = 1 To Count 
  
  dhGetValue("%T", @Name, SessionTGC, ".item(%d)", Sess) 
  dhGetValue("%o", @SessionEnCours, SessionTGC, ".item(%d)", Sess) 
  TabSessions(Sess)\Nom = PeekS(Name) 
  TabSessions(Sess)\Adresse = SessionEnCours 
  dhFreeString(Name) 
  dhFreeString(SessionEnCours) 
  
 Next 
    
EndProcedure 

Procedure AdresseSession(NomSessionChoisie.s) 

 For i = 1 To 5 
  
  If UCase(Trim(TabSessions(i)\Nom)) = UCase(Trim(NomSessionChoisie)) 
   ProcedureReturn TabSessions(i)\Adresse 
  EndIf 
  
 Next 
  
 ProcedureReturn 0 
  
EndProcedure 

Define Result.l 
Define Session.l 
NomSessionChoisie.s = "ERA191"

CreateSession() 
Session = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 

; The Variable Result is good 
Session = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 
; Error at this line 

Verfasst: 29.05.2008 17:45
von kwai chang caine
I found the error ......during i wait your answer, i thinking :

And if i reboot my PC :roll:
Nom, i have no error :oops:

Excuse me for disturb you :praise:
I believed, i have do again an error of code

I never thought of a hard problem :angry:

I wish you a very good day.

Verfasst: 29.05.2008 17:49
von ts-soft
Can you test the code with the puredisphelper_include.pbi?

Verfasst: 29.05.2008 18:20
von kwai chang caine
Hello TS-Soft.
I am proud to tell you about 8)

A great congratulation for your splendid lib, that save my life :praise:
I had a very great need it for my job
Congratulation again 8)

Well, I have found another thing.
It's not for reboot the computer, that the error disappears, but if i close the IBM emulator :shock:

My big code, or there is surely a mistake, create the error, and like the second simple code make the same error :twisted:
It's locked, i can't do anything :cry:

The alone solution is close the EXTRA emulator, and open it again and my little simple code (Whatever I have given you) works fine again.

I run my big bad code, and it's again locked ..........
If you have a solution .......

Perhaps a dhFreeString() is missing ??? :roll:
What you think about that ??
Can you test the code with the puredisphelper_include.pbi?
Where is this include ???? :roll:

Verfasst: 29.05.2008 18:42
von kwai chang caine
I found another strange things.
If i launch the emulator with the session A.edp (Its a file configuration)
The simple code works fine.

If i launch the emulator with a RunProgram.
The simple code write the 2 line in the debugger board, but an error appears at the last line Debug PeekS(Result)

Code: Alles auswählen

Structure SessionTGC 
 Nom.s[5] 
 Adresse.l[5] 
EndStructure 

Global Dim TabSessions.SessionTGC(5) 

Procedure CreateSession() 
    
 Define Count.l 
 Define SessionEnCours.l 
 Define Name.l 
 SessionTGC = dhCreateObject("Extra.Sessions") 
 dhGetValue("%d", @Count, SessionTGC, ".count") 
  
 For Sess = 1 To Count 
  
  dhGetValue("%T", @Name, SessionTGC, ".item(%d)", Sess) 
  dhGetValue("%o", @SessionEnCours, SessionTGC, ".item(%d)", Sess) 
  TabSessions(Sess)\Nom = PeekS(Name) 
  TabSessions(Sess)\Adresse = SessionEnCours 
  dhFreeString(Name) 
  dhFreeString(SessionEnCours) 
  
 Next 
    
EndProcedure 

Procedure AdresseSession(NomSessionChoisie.s) 

 For i = 1 To 5 
  
  If UCase(Trim(TabSessions(i)\Nom)) = UCase(Trim(NomSessionChoisie)) 
   ProcedureReturn TabSessions(i)\Adresse 
  EndIf 
  
 Next 
  
 ProcedureReturn 0 
  
EndProcedure 

Define Result.l 
Define Session.l 
NomSessionChoisie.s = "HOST"

CreateSession() 
Session = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 
dhFreeString(Result) 
Debug PeekS(Result)
; The Variable Result is good 
Session2 = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 
dhFreeString(Result) 
; Error at this line 
Debug PeekS(Result)
I don't understand anything :cry:

Verfasst: 29.05.2008 18:45
von ts-soft
kwai chang caine hat geschrieben:
Can you test the code with the puredisphelper_include.pbi?
Where is this include ???? :roll:
Is in the Download: http://www.purebasic.fr/english/viewtop ... 224#191224
See in the PureDisphelper_Include dir in the package! The include Version
have more functions and better frees the memory, i think :wink:

greetings
Thomas

Verfasst: 29.05.2008 19:00
von kwai chang caine
Thanks a lot, for this link.
I go out of my job now :D
But monday i return to the job :cry:

And i try this include and search this error memory
I wish you a good week end, you and the goog KIFFY.

I give you and KIFFY two big french kiss :mrgreen: