Restored from previous forum. Originally posted by tranquil.
Hi Fred!
Hm, can it be, that you allocate 64k Memory for each string I use in Dimensions and structures??? If its so, please make an option in the Compiler-Window that everyone should select the size for his strings before compiling. I definitly DO NOT need such a huge amount of space for a string. And thats why I run out of memory in my app. That can not be.
The best way is, if you only alloc the space needed for a string. You told something like that in another thread (or was it in the PB Chatroom!?)
Please, do something on that.
Otherwise we have to decrease the power of our app in a huge way!
Cheers
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
Only one question 2 Fred
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
What ? 64 kb for each string ?? It's not Visual Basic
. Each string use ONLY the needed space in memory. The 64k limit is the 'working' buffer, allocated once to do all the string operations (a$+a$ etc..). May be you run out of mem due to memory leaks detected by FakeFactory and already fixed (if you're using lot of strings in procedures).
Fred - AlphaSND
What ? 64 kb for each string ?? It's not Visual Basic

Fred - AlphaSND
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
Now I checked fakefactorys thread, but that is not the bug I mean.
I try the following source on my 128 MB Ram Notebook:
; Structure Fileshare (zu tauschenede Files)
Structure share
name.s ; Name der Datei
size.l ; Groesse
type.w ; Typ als Code
id.l ; Unique File-ID
comment.s[5] ; File Comments
EndStructure
maxuser = 10000 ;Max User 7886/1000 Files
sharedmax = 200 ; Maximum amount of files shared per user
Dim sharedfiles.share(maxuser,sharedmax)
If I try to set maxuser=8000 and sharedmax=1000 (Which means that every User on the serverside is able to share up to 1000 Files) the Dim Command crashes.
Why? 128 MB not enough? How can I obtain this crash problem?
Tranquilizer/ Secretly!
Registred PureBasic User
Now I checked fakefactorys thread, but that is not the bug I mean.

I try the following source on my 128 MB Ram Notebook:
; Structure Fileshare (zu tauschenede Files)
Structure share
name.s ; Name der Datei
size.l ; Groesse
type.w ; Typ als Code
id.l ; Unique File-ID
comment.s[5] ; File Comments
EndStructure
maxuser = 10000 ;Max User 7886/1000 Files
sharedmax = 200 ; Maximum amount of files shared per user
Dim sharedfiles.share(maxuser,sharedmax)
If I try to set maxuser=8000 and sharedmax=1000 (Which means that every User on the serverside is able to share up to 1000 Files) the Dim Command crashes.
Why? 128 MB not enough? How can I obtain this crash problem?
Tranquilizer/ Secretly!
Registred PureBasic User
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
Your structure is 34 bytes wide, for 10 000 * 200 * 34 = 70 Mb of CONTIGOUS memory. So yes, you're 128 MB notepad isn't enough for it. You're approach isn't very good for this kind of app. Better use the linked list which are much flexible and doesn't need a contigous memory area (so you could allocate up to 2GB of RAM).
For example:
NewList User()
NewList Files()
For each files, give an user ID etc..
Walking trough linked list is very very fast under pureabsic, so you could handle a very big amount of files/users.
Fred - AlphaSND
Your structure is 34 bytes wide, for 10 000 * 200 * 34 = 70 Mb of CONTIGOUS memory. So yes, you're 128 MB notepad isn't enough for it. You're approach isn't very good for this kind of app. Better use the linked list which are much flexible and doesn't need a contigous memory area (so you could allocate up to 2GB of RAM).
For example:
NewList User()
NewList Files()
For each files, give an user ID etc..
Walking trough linked list is very very fast under pureabsic, so you could handle a very big amount of files/users.
Fred - AlphaSND
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm