Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 03:56:26 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The grumpy old programmer room
Pages: 1 ... 229 230 [231] 232 233 ... 295
Print
Author Topic: The grumpy old programmer room  (Read 738219 times)
surt
Level 7
**


Meat by-product.


View Profile
« Reply #4600 on: September 26, 2014, 12:17:50 PM »

Typically I'd presume stack overflow is such a case but the numbers seem implausibly small for it to be an issue with stack limitations (no recursion in there?).
Have you tried to see if the problem still occurs when allocating on the heap?
Logged

Real life would be so much better with permadeath.
PJ Gallery - OGA Gallery - CC0 Scraps
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4601 on: September 26, 2014, 12:53:05 PM »

the problem doesn't occur when allocating on the heap. It also doesnt occur when using alloca oddly enough. I'm not super familiar with the internals of alloca though. Maybe there's a difference.

as for the questions. It was originally inside the block scope of a loop that ran about 4 times max (declared, defined and used in that scope). As a test I moved it to function scope and assigned one char manually.

edit : I have a suspicion it may have to do with the photoshop SDK doing something weird. Although I can't think of what they could do to mess with stack allocation like that. There's also a 32->64 bit migration guide for plugins, I have everything done adobe recommends doing but I wonder if that could possible be a cause...
« Last Edit: September 26, 2014, 12:58:25 PM by InfiniteStateMachine » Logged

standardcombo
Level 8
***


><)))°>


View Profile
« Reply #4602 on: September 26, 2014, 04:11:42 PM »

over-used?

It was too long a go to get into details, but it involved a huge tree structure with millions of points... Data started going into the wrong places, but I didn't go through the trouble of clearly understanding it due to a deadline. Changed to heap allocation and it was fixed.
Logged

Garthy
Level 9
****


Quack, verily


View Profile WWW
« Reply #4603 on: September 26, 2014, 06:21:47 PM »


odd. I create a char[500] inside a local function then later do some image processing that uses malloc for everything. If I assign even one char in that array all my image data gets messed up. Sometimes it looks like a lot of zero's (all black) sometimes it's a random pattern of green.

If i make the char[] a char[250] it works fine. I suppose there's a chance the stack and heap are touching but I'm not totally sure, I'm gonna have to dump out the contents of my image buffers and that array and find out. This is for a photoshop plugin and they have a bunch of weird memory management stuff. Maybe I exceeded some adobe limit causing everything to go haywire.

It's not an issue because I don't need that char[] but it's one of those things I wish I knew the reason it happens. I also think it may have happened when the code for the image processing was refactored into its own method but I'd have to confirm that more thoroughly.

Could it be that you are running in an environment such that by the time your code is called, the stack is critically short of space? Or perhaps you are only allowed a small bit of stack space in the environment set up for the plugin?

One thing you could try is to allocate some extra space before and after the stack storage you are using, and fill it with guard values at the start of the call, and check that they are the same values at the end. It's possible that there are bugs in some of the calls you make while in the function that that are corrupting the stack. If you set this up and it fails, all you need to do is to keep adding guard checks until you can get it down to the single line or call that causes the corruption.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4604 on: September 26, 2014, 08:56:01 PM »

Damn, parsing is hard.

Really hard.

Not wanting to use other libraries except for cross-platform stuff is going to be the death of me.
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4605 on: September 27, 2014, 05:07:37 PM »


odd. I create a char[500] inside a local function then later do some image processing that uses malloc for everything. If I assign even one char in that array all my image data gets messed up. Sometimes it looks like a lot of zero's (all black) sometimes it's a random pattern of green.

If i make the char[] a char[250] it works fine. I suppose there's a chance the stack and heap are touching but I'm not totally sure, I'm gonna have to dump out the contents of my image buffers and that array and find out. This is for a photoshop plugin and they have a bunch of weird memory management stuff. Maybe I exceeded some adobe limit causing everything to go haywire.

It's not an issue because I don't need that char[] but it's one of those things I wish I knew the reason it happens. I also think it may have happened when the code for the image processing was refactored into its own method but I'd have to confirm that more thoroughly.

Could it be that you are running in an environment such that by the time your code is called, the stack is critically short of space? Or perhaps you are only allowed a small bit of stack space in the environment set up for the plugin?

One thing you could try is to allocate some extra space before and after the stack storage you are using, and fill it with guard values at the start of the call, and check that they are the same values at the end. It's possible that there are bugs in some of the calls you make while in the function that that are corrupting the stack. If you set this up and it fails, all you need to do is to keep adding guard checks until you can get it down to the single line or call that causes the corruption.


Those are both very possible. I'll definitely do that test as well. I may get to the point where I just dump the contents of the data after each line in that function to try to see what's going on exactly.
Logged

surt
Level 7
**


Meat by-product.


View Profile
« Reply #4606 on: September 27, 2014, 05:29:26 PM »

Not wanting to use other libraries except for cross-platform stuff is going to be the death of me.
Use a parser generator and you don't need no stinkin' libraries.
Logged

Real life would be so much better with permadeath.
PJ Gallery - OGA Gallery - CC0 Scraps
framk
Level 2
**


I don't know anything


View Profile
« Reply #4607 on: September 28, 2014, 07:37:47 AM »

Nothing quite like spending a Sunday afternoon reading through the SVG1.1 specification document...
Logged

nikki
Level 10
*****


View Profile
« Reply #4608 on: September 29, 2014, 06:18:33 AM »

Ough yeah svg, had that moment a few weeks ago, filthy stuff, glad I got it nuked in our office Wink
Logged
Sik
Level 10
*****


View Profile WWW
« Reply #4609 on: September 29, 2014, 02:26:23 PM »

My problem with comitee-made standards: they tend to be overly complicated for no real reason -.-' Also one of the reasons why I don't like COLLADA (it's like the extreme example of this).
Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #4610 on: September 29, 2014, 03:10:26 PM »

SVG is definitely a mess, but it's about the best you'll get as far as vector image formats go. Sure would be nice if there were a better alternative.
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #4611 on: September 30, 2014, 02:18:23 AM »

Oh, Collada... I left several angry remarks in the Assimp source when writing the loader for it. The amount of loops you have to jump through just to get some data is staggering.

So thanks for the note: when I need SVG, I'll just find some library and bend it to my will.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4612 on: September 30, 2014, 07:09:24 AM »

So my map procedure is working great, except that it seems to iterate the list in reverse order.  I'm at a total loss as to why this is happening Lips Sealed
« Last Edit: September 30, 2014, 07:17:06 AM by Boreal » Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4613 on: September 30, 2014, 02:27:27 PM »

 Cry

Turns out all I had to do was put the apply and recursive map procedures outside the return statement.

Code:
// this is C++, vastly simplified
Exp *car = apply(procedure, car(list));
Exp *cdr = map(procedure, cdr(list));
return(cons(car, cdr));

Hours and hours of frustrated staring to find out that this is the solution.
I swear I tried this near the beginning and it didn't work No No NO
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4614 on: September 30, 2014, 05:33:54 PM »

arg. Was using a mixed mode dll w/CLR

when I pass a const char * from an unmanaged compilation unit to a managed compilation unit it seems to come in like it was never assigned to :|

I decided to just remove the CLR portion and go back to win32. That was a lot easier. The reason I was using mixed mode in the first place was I was trying to see if I could get 2 way interop going. I can kind of, but I can't call to the instance of the dll in memory I need to target.

Decided to use named pipes instead.
Logged

Udderdude
Level 10
*****


View Profile WWW
« Reply #4615 on: October 09, 2014, 05:52:20 PM »

Fun with recompiling games for DOS using DJGPP and Allegro.  You never realize just how little you gave a crap about how much RAM you were using until you're back to trying to cram it all into 16 MB .. WTF
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4616 on: October 10, 2014, 08:03:59 AM »

Saw that AMD Catalyst wanted to update.  Got really excited that maybe AMD finally had their 4.5 driver ready.

 Cry
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
Udderdude
Level 10
*****


View Profile WWW
« Reply #4617 on: October 10, 2014, 08:48:13 AM »

AMD drivers will always be shit. Shrug
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4618 on: October 10, 2014, 09:26:30 AM »

AMD drivers will always be shit. Shrug

I can't believe I bought a 280x in May when I could have waited for a little bit and gotten a 970 or something.
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
Sik
Level 10
*****


View Profile WWW
« Reply #4619 on: October 10, 2014, 10:51:22 AM »

Fun with recompiling games for DOS using DJGPP and Allegro.  You never realize just how little you gave a crap about how much RAM you were using until you're back to trying to cram it all into 16 MB .. WTF

Yeah, my game uses 40MB of RAM which sucks =/ (although that's on a 64-bit system, on 32-bit Windows I get 24MB instead, which makes me wonder how much data got expanded in the process O_O and this is in C, not some language which is pointer-heavy internally)

Granted, in large part optimizations are the reason of that memory usage. Sprites are loaded as uncompressed 32-bit RGBA bitmaps. Sound effects are loaded as uncompressed 16-bit waveforms. (yes, decompressed at load time) Music is stored as pure Vorbis data (i.e. prerendered as opposed to some instrument-based format). It's not hard to see how much memory that can take up. Older systems prefered formats with much smaller footprint (e.g. 8-bit paletted instead of 32-bit RGBA), so if the game was designed for those systems chances are the RAM usage would be much smaller as well.

(EDIT: made last sentence a bit less confusing)
Logged
Pages: 1 ... 229 230 [231] 232 233 ... 295
Print
Jump to:  

Theme orange-lt created by panic