Page 1 of 1

Invalid memory access on "procedurereturn" for callback?

Posted: Tue Jun 28, 2011 11:42 pm
by jassing
Image

Ideally I'd like to understand why that's happening occasionally when I shut down the program. it does not happen everytime; nor can I find a pattern to it. At best, I'd like to suppress the error.

Ideas?

(I am not using \lParam)

Is the error more on memory that was accessed during the procedure or is it really on procedurereturn?

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 12:30 am
by netmaestro
There are several possible reasons for that happening. Without seeing a working code snippet it's impossible to tell what the culprit is.

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 5:06 am
by jassing
netmaestro wrote:There are several possible reasons for that happening. Without seeing a working code snippet it's impossible to tell what the culprit is.
if there are several might you be able to enumerate a few of the top contenders?

As I said I cannot make it happen all the time, so the code snippet I run here may not make it there.
one in a 100 runs might get it. Same identical code, same exact data. Same pc.

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 5:54 am
by rsts
jassing wrote: if there are several might you be able to enumerate a few of the top contenders?
In my experience, illegally writing to memory (buffer overflow, overwriting variables, code, constants, etc) and improper use of threads, come to mind as having bitten me.

cheers

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 7:21 am
by eesau
Have you tried removing the callback before exiting your application?

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 4:56 pm
by jassing
eesau wrote:Have you tried removing the callback before exiting your application?
Of course that would fix it -- the return is from the callback....

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 4:58 pm
by jassing
rsts wrote: In my experience, illegally writing to memory (buffer overflow, overwriting variables, code, constants, etc) and improper use of threads, come to mind as having bitten me.

cheers
Thanks. I've checked memory buffers, I've gone thru the code to ensure I'm not re-using a pointer for one structure for another... I have no idea how I could overwrite a constant.
How (or what) constitutes an "improper use of threads"?

thanks
-josh

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jun 29, 2011 9:17 pm
by rsts
jassing wrote: How (or what) constitutes an "improper use of threads"?

thanks
-josh
My bad. My memory failed me once again. It was an improperly used API AttachThreadInput_

I've also had IMA's from the callback if/when exiting the routine with an incorrect return value.

These things can be very frustrating to track.

cheers

Re: Invalid memory access on "procedurereturn" for callback?

Posted: Wed Jul 06, 2011 4:37 pm
by jassing
rsts wrote: I've also had IMA's from the callback if/when exiting the routine with an incorrect return value.
Hmm. I'll have to see what an incorrect return value would be; I thought I read it was a "zero or non-zero" affair... I must have misread. Thanks.
rsts wrote: These things can be very frustrating to track.
Good to know that I'm not alone. Thanks
-j