Page 1 of 1
KERNEL32!HeapLock() ?
Posted: Fri Oct 23, 2009 6:53 pm
by XianForce
Code: Select all
#0 00401BAB ??() (??:??)
#1 00934748 ??() (??:??)
#2 0022FCA0 ??() (??:??)
#3 0022FCB0 ??() (??:??)
#4 7755C56F KERNEL32!HeapLock() (C:\Windows\system32\kernel32.dll:??)
#5 00930000 ??() (??:??)
#6 00000000 ??() (??:??)
Okay, I REALLY hate to be so vague on this, but I don't want to be someone that posts a crap load of code asking someone to go through it.
My project compiles fine, but I get a segfault, and here's the call stack from the segfault... gives no line numbers so I haven't the slightest idea of where to even begin to look.
To those that will tell me to use google, sorry, tried and failed. Only thing I could find was references to antivirus's and malware.
I have a lot of files, and since this segfault is being vague, I can't even imagine where to start to look.
So does anyone know what this at least means? Like what went wrong exactly? I'm hoping someone will, so I can narrow down my search.
Thanks in advance for any help =D
Re: KERNEL32!HeapLock() ?
Posted: Fri Oct 23, 2009 7:11 pm
by Falco Girgis
You can do better than this. printf/cout at strategic points until it crashes. Use the visual studio debugger to set breakpoints. What you're giving us is 99.99% worthless. All that I can tell you is that it's most likely something to do with dynamic memory allocation. Check your new and delete calls.
Re: KERNEL32!HeapLock() ?
Posted: Fri Oct 23, 2009 8:09 pm
by short
GyroVorbis wrote:You can do better than this. printf/cout at strategic points until it crashes. Use the visual studio debugger to set breakpoints. What you're giving us is 99.99% worthless. All that I can tell you is that it's most likely something to do with dynamic memory allocation. Check your new and delete calls.
I really have no idea how much you know but you could try stepping through your program line by line.
First set a break point at the beginning of your program and run it in debug mode. Step over function calls until you figure out which one causes the segfault. When you've isolated the function call that causes the crash, set a new breakpoint there and then step into the function.
Once you begin stepping through your program like this it is usually much easier to isolate where the error is coming from.
Oh and welcome to debugging random errors. It sucks. But you'll eventually get good at it
Re: KERNEL32!HeapLock() ?
Posted: Fri Oct 23, 2009 8:30 pm
by avansc
as far as i know HeapLock() is a winapi function, that lock the heap preventing heapwalk to fux things up.
and im almost certain its centric to multithreaded shit. ie. a thread "locks" the heap, so no other thread can allocate of release heap memory until that thread has unlocked the heap.
its a sort of mutex i spose. not sure how you are using it. so without code or any other info its hard to even begin to give advice.
Re: KERNEL32!HeapLock() ?
Posted: Sat Oct 24, 2009 9:42 am
by XianForce
Sorry =/. I used the breakpoints, and that's the information I got. Right now I'm not at home, but when I get home, I'll put some stuff on the console screen, and post what I get.
Re: KERNEL32!HeapLock() ?
Posted: Sun Oct 25, 2009 12:38 am
by short
did you try setting a breakpoint at the very beginning and then stepping through the program line by line?
Re: KERNEL32!HeapLock() ?
Posted: Sun Oct 25, 2009 12:57 am
by XianForce
short wrote:did you try setting a breakpoint at the very beginning and then stepping through the program line by line?
Yeah, and that's exactly what I got. I worked a little bit on it today... ran my debug binary, found where it was crashing, and fixed it... or so I thought. But now it runs through the loop perfectly fine, and I get this:
Code: Select all
#0 774F7DFF ntdll!DbgUiConvertStateChangeStructure() (C:\Windows\system32\ntdll.dll:??)
#1 7753D0D0 ntdll!EtwEventEnabled() (C:\Windows\system32\ntdll.dll:??)
#2 744EB213 ??() (??:??)
#3 00000000 ??() (??:??)
And again, I'd just like to know if any of you know what this even means, if I could provide more information without posting crap loads of code, I would.
Re: KERNEL32!HeapLock() ?
Posted: Sun Oct 25, 2009 5:02 pm
by short
what environment are you running in?
OS and compiler / debugger
Re: KERNEL32!HeapLock() ?
Posted: Sun Oct 25, 2009 6:01 pm
by XianForce
short wrote:what environment are you running in?
OS and compiler / debugger
CodeBlocks IDE, Windows Vista, MinGW Compiler
Re: KERNEL32!HeapLock() ?
Posted: Tue Oct 27, 2009 7:33 pm
by MarauderIIC
What statements are run before it goes into the almost irrelevant assembly and things? That's where your clues are.
Re: KERNEL32!HeapLock() ?
Posted: Fri Oct 30, 2009 9:25 pm
by XianForce
MarauderIIC wrote:What statements are run before it goes into the almost irrelevant assembly and things? That's where your clues are.
Yeah, I ended up rewriting a portion of my code, and now it's fixed, so still not sure to what it was exactly. It didn't go into that 'irrelevant assembly and things' in a set place, sometimes it screwed up with taking input, sometimes it screwed up with logic, and other times it screwed up with updating the screen.
But I'm not gonna worry about it anymore, it's gone =p
EDIT: I'm gonna throw a big 'Nevermind' on that one. Seems the SegFault is in my Release binary, yet not my Debug binary 0.o.
Re: KERNEL32!HeapLock() ?
Posted: Sun Nov 01, 2009 11:02 am
by dandymcgee
XianForce wrote:MarauderIIC wrote:What statements are run before it goes into the almost irrelevant assembly and things? That's where your clues are.
Yeah, I ended up rewriting a portion of my code, and now it's fixed, so still not sure to what it was exactly. It didn't go into that 'irrelevant assembly and things' in a set place, sometimes it screwed up with taking input, sometimes it screwed up with logic, and other times it screwed up with updating the screen.
But I'm not gonna worry about it anymore, it's gone =p
EDIT: I'm gonna throw a big 'Nevermind' on that one. Seems the SegFault is in my Release binary, yet not my Debug binary 0.o.
Check your pointers and variable definitions. Debug mode automatically zeroes those sorts of thing where as release mode does not. Segfault is often the result of accessing a pointer to garbage memory, finding which one is the part that's no fun.