Memory-Fehler "PureDishelper" [Gelöst]

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Memory-Fehler "PureDishelper" [Gelöst]

Beitrag 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
Zuletzt geändert von kwai chang caine am 01.06.2008 08:37, insgesamt 6-mal geändert.
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
Kiffi
Beiträge: 10714
Registriert: 08.09.2004 08:21
Wohnort: Amphibios 9

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

Beitrag von Kiffi »

Hello kwai chang caine,

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

Greetings ... Kiffi
a²+b²=mc²
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag 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 
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag 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 
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag 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.
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Can you test the code with the puredisphelper_include.pbi?
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag 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:
Zuletzt geändert von kwai chang caine am 29.05.2008 18:43, insgesamt 1-mal geändert.
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag 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:
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag 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
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag 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:
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Antworten