memory allocation and string managment

Everything else that doesn't fall into one of the other PB categories.
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

memory allocation and string managment

Post by Denis »

Fred/Freak,

i've readen some posts about to free sting using asm but they are not native functions.

First of all, my quetion is :

I have a structure for exemple like this

Code: Select all

Structure essai
String_1$
String_2$
Long_1.l
endstructure
I allocate memory

Code: Select all

*pt.essai = allocatememory(sizeof(essai))
After that i use internal *pt\String_1$ etc

If i use this

Code: Select all

Freememory(*pt)
the memory block is freeing but what about internal strings?

If they don't be freeing , how to free them ?

Is there the same managment when you allocate a global or protected *pt ?


I use a code which use intensive internal strings like above, so, i want to free strings before destroying memory block (not *pt\String_1$ ="").

any chance to get FreeString(...) command ?
A+
Denis
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

The internal strings in these cases are not freed and you have to do it yourself (see Freak's code in the link below).

Your request has also been made before! :wink:

http://www.purebasic.fr/english/viewtop ... eepbstring
I may look like a mule, but I'm not a complete ass.
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

srod wrote:The internal strings in these cases are not freed and you have to do it yourself (see Freak's code in the link below).

Your request has also been made before! :wink:

http://www.purebasic.fr/english/viewtop ... eepbstring
Tks srod for infos
srod wrote:Your request has also been made before! :wink:
Don't find this :oops:

May it's time to have a native command :wink:
A+
Denis
Post Reply