June 15, 2024, 10:26:09 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


stack size

Started by Jerry Muelver, February 02, 2009, 12:22:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jerry Muelver

February 02, 2009, 12:22:43 PM Last Edit: February 02, 2009, 12:35:45 PM by Jerry Muelver
Programming by RVA (Random Variable Assignment) instead of actual knowledge and training certainly has its challenges....

I'm pulling a 1.4 meg file out of "Resources" into a richedit control resized to 1600000. Couldn't do it at first, until I guessed that "stack size" would have something to do with limitations. So I increased the stack size for the project to 2097152 and it seems to work just fine. Is that enough for a 1.4 meg RTF string to live and breathe (and respond to @RTFINDTEXT, which it is doing quite well)? Should I be doing something about "commit stack size" as well?


Ionic Wind Support Team

You'll be fine.

Although I would never define a string that size on the stack, instead preferring to allocate them dynamically.
Ionic Wind Support Team

Jerry Muelver

Thanks, Paul. I'll look at dynamic allocation.... Hmm.... I think I'm doing that already.

I'm doing this:
DEF buffer: pointer
buffer = new(char,1600000)
...
CONTROL d1,@RICHEDIT,"",7,350,570,80,0x50B000C4,10
...
CONTROLCMD d1,10,@RTSETLIMITTEXT,1600000

And then use it thus:
flen = LOADRESOURCE(333,324, buffer)
CONTROLCMD d1, 10, @RTLOAD, #<string>buffer, 0

It just now occurred to me -- should I do a DELETE on "buffer"? The only use is to get the resource loaded into the richtext control.

Ionic Wind Support Team

Yes you should be deleting the buffer.

Paul.
Ionic Wind Support Team

Jerry Muelver

Use it, and throw it away, hey? Okay, thanks!