Using strings as buffers...

Everything else that doesn't fall into one of the other PB categories.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by dmoc.

I have (quickly) checked that the following does not leak memory once the program has ended but will there be memory loss if this technique is used repeatedly, poss in a procedure? To put it another way, will PB garbage collect the whole string or only upto the NULL?

buffer.s = space(1024)
SomeSysFunction_(@buffer); Returns string of len < 1024
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

It frees the whole memory buffer, no problem.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by dmoc.

Ta
Post Reply