This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Stack


Stack

Postby Dan East » Dec 19, 2003 @ 1:42am

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby fzammetti » Dec 19, 2003 @ 4:21am

I'm not sure the direct answer to your question Dan, but I recall something about 32MB total for all stack space across all processes. Is it possible that your 2MB allocation is overrunning THAT limit, even if 2MB would otherwise be OK?

As for gracefully reporting stack out of space, I'm very surprised it's not throwing a system access violation. I believe that's what's supposed to happen when stack space is exceeded (I'm trying to remember some details that I caught some months ago looking through TechNet docs, so I may be way off in this). I know the OS should terminate your app, I'd bet that's happening, I'm just wondering if there's a way to trap the fault, maybe even with an external app. At least then you'd know it was a stack out of space issue.
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby yuit » Dec 19, 2003 @ 4:50am

I've had this problem as well.

I had an array of wchar_t [10*1024] and my app would randomly crash. I changed the declaration from:

wchar_t buffer[10*1024]; to

malloc (sizeof(wchar_t) * 10 * 1024)

which seems to have solved the problem.
yuit
pm Member
 
Posts: 23
Joined: Dec 8, 2003 @ 7:31pm


Postby Dan East » Dec 19, 2003 @ 7:40am

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Kzinti » Dec 19, 2003 @ 8:33am

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Conan » Dec 19, 2003 @ 9:30am

What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Postby ppcStudios » Dec 19, 2003 @ 12:25pm

Datatype misalignment issues can be very common - Warlords II had a ton of them crop up. And they cause some of the goofiest bugs and crash issues you could ever imagine.

Sometimes you get lucky and eVC will tell you there is a Datatype Alignment error (if you are debugging directly on the device) but for the most part you'll need to dissect your structs and either align them by padding or #pragma pack'ing them.

I can't say for sure that allocating a 2MB block of memory won't fail (as I've never tried it), but if new or free doesn't fail then its a pretty good bet its allocating it properly. Warlords II has some pretty healthy chunks of memory allocated at startup, but certainly not 2MB continguous.

Dan, you're not allocating this as a global variable are you? I found serious problems using large data chunks as globals on the PPC and they involved running into memory limitations on the devices (I don't remember offhand what the problem was, but I may have written it down somewhere - I'll look today).
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Exocet » Dec 19, 2003 @ 4:39pm

Exocet
pm Member
 
Posts: 18
Joined: Jun 29, 2003 @ 2:24am
Location: Toronto, Canada


Postby refractor » Dec 19, 2003 @ 7:20pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron