Invalid memory access on "procedurereturn" for callback?

Windows specific forum
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Invalid memory access on "procedurereturn" for callback?

Post 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?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

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

Post 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.
BERESHEIT
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

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

Post 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.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

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

Post 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
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

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

Post by eesau »

Have you tried removing the callback before exiting your application?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

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

Post 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....
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

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

Post 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
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

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

Post 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
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

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

Post 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
Post Reply