> 64k Strings Hack - Does it work or not?

Everything else that doesn't fall into one of the other PB categories.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

no, it would stop 99.9% of the complaints ;-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

hahahaha

TRUE!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

This hack does not work with all PB function as pointed out by Danilo here:
viewtopic.php?t=9194 :?
--Kale

Image
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Yea - that's just the kind of thing I was afraid of...

Ohhhh Freddy Fred... Do you consider that a bug?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
freak
PureBasic Team
PureBasic Team
Posts: 5947
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Raising the limit is imho not neccesary.
Most program do not even need 64k of string length (i only hit that limit
once, through a bug in my program :wink: ), so why waste the memory like
that?

If you just want to write a little tool, that displays one or two words in it's
gui, you don't want it to use 10 megs of ram because of that.

Timo
quidquid Latine dictum sit altum videtur
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

...,

Indieed most of the time allcatememory is good enough to load a full file in memory, parse it, and free it after keeping the part you need.

I do not consider long strings as a real requirement, as a bypass exists, and when we, all programers I mean, use strings, it is most of the time to parse lines. And lines are not so much often long enough.

Maybe one good Purebasic's add would be to create a 'regular' library to have an alternative to FindString and StringField Purebasic commands for long strings.

Well ... on my own I actually use the 'string equivalence' tip I have :

Code: Select all

Structure StringBytes
  Bytes.b[64000]
EndStructure

String.s = "whatever you want"

  *MyString1.StringBytes = @String ; PokeB(@String, PeekS(@String))
This makes possible to request either a string part using String variable or

Code: Select all

*MyString\Bytes[index]
to evaluate a single byte.

This is very fast and useful.
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

freak wrote:Raising the limit is imho not neccesary.
Most program do not even need 64k of string length (i only hit that limit
once, through a bug in my program :wink: ), so why waste the memory like
that?

If you just want to write a little tool, that displays one or two words in it's
gui, you don't want it to use 10 megs of ram because of that.

Timo
Ok, I'm back to being confused again.

How would raising the possible upper limit of strings cause more memory to be used? It's already been said (and I've assumed said correctly) that you only see more memory usage if you actually use the space. So a 10k string still only takes 10k of memory - even if it's *possible* to write 5 megs of data into that same string..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Ok, now that fr34k smacked me around a little bit on IRC I get it...
because PB always allocates a fixed buffer for string manipulation
It will only allocate that buffer once, but it still allocates it. So increasing the limit to 10 megs would mean that a one time allocation of 10 megs of memory would be made when your exe starts up :-)

But...
<fr34k> Windows does that kind of smart though.. if you request a 100mb buffer and only use the first 10 byte, it will only allocate 10 byte, and increase that buffer if you need more. Other OS don't do that though
... so there is hope yet (at least for we single platform developers).

Gotcha... Thanks to everyone!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

Karbon,

If you check it with the code I posted @ viewtopic.php?t=10760, you will see that only used string is consumed, but it does not mean exactly this byte to byte as paging using W32 is 64K based AFAIK.

Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
Post Reply