raspberry pi threading problem

Just starting out? Need help? Post your questions and find answers here.
RSrole
User
User
Posts: 72
Joined: Fri Apr 29, 2022 8:27 pm

raspberry pi threading problem

Post by RSrole »

I'm new to Linux so I don't really know what I'm doing, but....

I've taken a program that I wrote for windows and trying to make it work in linux. The problem I've run into is that in some threads, I get "Invalid Memory access" and array out of bounds crashes in places that just can't be. For instance on a line of code that checks a global integer as true of false or on a array that the index is well within bounds. The threads work fine in windows, so I have no clue.

And I'm using the latest PB with the c++ back end.

Any thoughts are appreciated
Russ
User avatar
STARGÅTE
Addict
Addict
Posts: 2260
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: raspberry pi threading problem

Post by STARGÅTE »

RSrole wrote: Tue Mar 19, 2024 10:05 pm I'm new to Linux so I don't really know what I'm doing, but....

I've taken a program that I wrote for windows and trying to make it work in linux. The problem I've run into is that in some threads, I get "Invalid Memory access" and array out of bounds crashes in places that just can't be. For instance on a line of code that checks a global integer as true of false or on a array that the index is well within bounds. The threads work fine in windows, so I have no clue.

And I'm using the latest PB with the c++ back end.

Any thoughts are appreciated
Russ
Code?

There are differences between Windows and Linux. For example, gadget commands can't be used in Threads.
Do you compile 32 bit or 64 bit?
If you compile a 64 bit program you should check, if you use at some point a long (.l) instead of a integer (.i) where it should be an integer.

When a program crashes at a position where it shouldn't, it is a sign for memory heap corruption.
You overwrite somewhere a memory buffer and at some location is affected by that.
But without code, it is just guessing.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
idle
Always Here
Always Here
Posts: 6031
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: raspberry pi threading problem

Post by idle »

try using the purifier. it will identify any out of bounds writes, and make sure you only use postevent to interact with gui from threads.
RSrole
User
User
Posts: 72
Joined: Fri Apr 29, 2022 8:27 pm

Re: raspberry pi threading problem

Post by RSrole »

You guys nailed it. Thanks for the tips!
Post Reply