PROP2 Memory Free - function or command?
PropGuy2
Posts: 360
Maybe I missed it - But does the PROP2 library have any memory Free, or memory Used functions or commands ? If not, Are there any work-a-rounds ?
Something like:
value := USED(x ) 'returns the number of HUB/RAM bytes used (code & data) in a Prop2 program
FYI, It would be nice to have.
Comments
I guess you are referring to the Spin2 language. Probably the closest there is to memory management in Spin2 is just the VAR and DAT sections. Certainly no malloc() like functions built in.
I'm not sure how clean an "object" could handle implementing a general layer under all other objects. That'd be the closest to making your own library.
PS: I think one reason for design of Spin language was do away with dynamic memory structures. To avoid the pitfalls that come with such.
While in flexbasic I used __builtin_alloca for this purpose. It allocates a memory on a top of the stack and returns a pointer to it, so you can know where is the top of the stack, and this is also a top of Flexbasic used memory (code->heap->stack, growing up)
Of course this is the main stack and it can grow up more after this.