- This topic has 142 replies, 8 voices, and was last updated 10 years ago by Admin.
-
AuthorPosts
-
July 22, 2013 at 8:53 pm #186017cyberpunkMember
Removing the S from the MEM_RELEASE Const did allow it to return a 1
July 22, 2013 at 8:55 pm #186016ChikeMember@ManicMike wrote:
Removing the S from the MEM_RELEASE Const did allow it to return a 1
You talked too soon….
I said 3 lines.July 22, 2013 at 9:06 pm #186015cyberpunkMemberLOL!
Then I must be dreaming because I have now commented out my DECOMMIT and using the MEM_RELEASE statement and it is returning a 1 on the first one and a 487 on the second one
I went ahead and commented out the other DECOMMIT statements and re-enable MEM_RELEASE on on four of my subs and when running the program it is much better but still using more memory than what it was with the DECOMMIT. Which means I have been convinced DECOMMIT is better and think i get why too. Damn shame I had to take the long route to get here. but I couldn’t afford the Bus ticket
July 22, 2013 at 9:15 pm #186014ChikeMemberYou’re brain is a realy good subject for a study.
Is it that complicated to run those 3 lines as I posted them and see what you get for each one of them?
No more, no less, no commenting out anything, no adding anything anywhere else, just those 3 lines.
I am trying to make a conclusion here.July 22, 2013 at 9:16 pm #186013cyberpunkMemberDude, I did that three or four posts ago
July 22, 2013 at 9:21 pm #186012ChikeMember@ManicMike wrote:
Dude, I did that three or four posts ago
You mean this?
@ManicMike wrote:Removing the S from the MEM_RELEASE Const did allow it to return a 1
July 22, 2013 at 9:24 pm #186011cyberpunkMember@Chike wrote:
@ManicMike wrote:
Dude, I did that three or four posts ago
You mean this?
@ManicMike wrote:Removing the S from the MEM_RELEASE Const did allow it to return a 1
This:
'deallocate the memory and close the process handle
'**************************************************
(1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
(0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
If result = 0 Then
(87) result = Marshal.GetLastWin32Error
'result = GetLastError()
End If
(0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
If result = 0 Then
(87) result = Marshal.GetLastWin32Error
'result = GetLastError()
End If
July 22, 2013 at 9:26 pm #186010cyberpunkMemberFYI Adding the S back brings back the error 87’s
ANd I am only removing the S from the MEM_RELEASE Const
July 22, 2013 at 9:33 pm #186009ChikeMemberI thought we put the S behind us already.
These are results with S though.July 22, 2013 at 9:39 pm #186008cyberpunkMember@Chike wrote:
I thought we put the S behind us already.
These are results with S though.Betcha $100.00 lol
Seriously dude, That is the fix, I have full control of the issue i can recreate it at will have twice now.The error 87’s ONLY come WITH the S in the MEM_RELEASE Const
i get no error at all without the SDo I get that A+ now?
Cool we have two solutions, but dude seriously I could not have done it without your help. I really had no idea how to troubleshoot once using a breakpoint, i got it now, still lacking a boatload of experience though.
The memory usage is better, I see more memory releases..the baseline is 4K memory set change deltas with a lot of 4K releases that I did not have…proof again of MEM-RELEASE functioning w/o the S
But MEM_DECOMMIT is my choice I think, I like the idea of having the memory reserved for my LVITEM
July 22, 2013 at 9:48 pm #186007ChikeMember@ManicMike wrote:
@Chike wrote:
I thought we put the S behind us already.
These are results with S though.Betcha $100.00 lol
Seriously dude, That is the fix, I have full control of the issue i can recreate it at will have twice now.The error 87’s ONLY come WITH the S in the MEM_RELEASE Const
i get no error at all without the SDo I get that A+ now?
Yes the fix is removing the S, and no you’re not getting A+, actually i was thinking to denote you to A- for partial answers.
@ManicMike wrote:
Cool we have two solutions, but dude seriously I could not have done it without your help. I really had no idea how to troubleshoot once using a breakpoint, i got it now, still lacking a boatload of experience though.
No there is only one solution, now you understand why I need full answers and making a solid conclusion?
What are the results for those lines without the S?July 22, 2013 at 9:52 pm #186006cyberpunkMemberlol good thing we didn’t shake on that bet then, huh?
I will look at exactly what that S is doing and it helps that I have a nice overview from your earlier posts.
But you had mentioned that the S should not have been there. the S is after all the other MEM_* statements, and they seem to work just fine.Chike, I appreciate your patience in dragging this out. I hope I did not make it too tedious lol
July 22, 2013 at 10:25 pm #186005cyberpunkMemberWithout the S in MEM_RELEASE
'**************************************************
(1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
(1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
If result = 0 Then
() result = Marshal.GetLastWin32Error
'result = GetLastError()
End If
(0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
If result = 0 Then
(487) result = Marshal.GetLastWin32Error
'result = GetLastError()
End IfWith S in MEM_RELEASE
**************************************************
(1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
(0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
If result = 0 Then
(87) result = Marshal.GetLastWin32Error
'result = GetLastError()
End If
(0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
If result = 0 Then
(87) result = Marshal.GetLastWin32Error
'result = GetLastError()
End IfErgo, 😀
When the S is used I cannot use MEM_RELEASE at all but I CAN use MEM_DECOMMIT
Without the S I can use either MEM_RELEASE or MEM_DECOMMIT, but I think MEM_DECOMMIT is the better choice.July 23, 2013 at 12:05 am #186004ChikeMemberSo what can we learn from this.
First the most obviouse, is that the S va’se some bad value for MEM_RELEASE, as of the whys I’ve mentioned it aroud Departurs post sp I won’t repear it again.BTW did I mention you can view values as hexdecimal in the debugger? Sorry if I didn’t, you can right click the value that pop up when you hover with the mouse over the variable, or in local varivles and select the hexdecimal view.
And the second conclusion is that you can call VirtualFreeEx with MEM_RELEASE after calling it with MEM_DECOMMIT but not after MEM_RELEASE.
You could also try calling MEM_DECOMMIT after MEM_RE:EASE and see you get the same result/
What does that mean? It means the pointer is still valid after decommit, but is invalid after it is releaced, hence your problem cannot be solved by using decommit. It may last longer because no physical pages are commited but the address space is reserved.
“Decommits the specified region of committed pages. After the operation, the pages are in the reserved state.”
July 23, 2013 at 12:17 am #186003cyberpunkMemberAh! Very well explained. I totally get what you trying to show me and there is no way I would have figured that out on my own which is why a good foundation is important and I will always lack that. I wish I could go to school for it but for now my foundation is dirt and I swear they got it from a cow pasture lol
Thanks for all the time and for laying things out in an easy to follow manner Chike. I did learn a great deal not only about how to debug, and thanks for the hex tip, i did not know that, but I also have learned more about this memory hooking process works, clearly i have a lot to learn but now with my newly discovered debug tools I can play around. For now I really want to get my features coded, and then work on getting some of the data attached to an SQL server. it started out as just wanting to query admin lists and some of the other filters i have set up for room text on a per room basis, and a database would mean one table and an assortment of queries to get the lists for each room. Plus I want to use active filter that only runs the filters on users that are in the room. But I also want to archive room logs. Not consistently, but I want it dumping to a database and then i will decide if there was anything worth saving. But I also want to track mic events as well for statistical reasons and well mainly just cuz I can lol
The entire project was always intended as more than just getting a much needed mic timer but to also be more fun than the “Hello World” projects.The next feature will be remote control of the program from room text and I already have ideas on that. Then I hope to start that Fantasy Football app, but that will be a massive undertaking, this is more my speed for now. And as noted I have plenty of features left to implement. Thanks again Chike for everything.
So, it is just a relief to have this issue off my plate.
-
AuthorPosts
Related
- You must be logged in to reply to this topic.