Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing Memory Manager
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ericfourfour




PostPosted: Fri Nov 24, 2006 4:04 pm   Post subject: Turing Memory Manager

This is a memory manager. To use it you create a pointer object (aka smart pointers) and give the pointer the object it will be pointing to. (This is very hard to explain considering most of Turing's audience will never go this far with Turing). Once you are done with the pointer you can free it and if the object has nothing pointing to it, it will go to the deadObjects list. If you want to get rid of all of the unused objects you call the garbage collector. If you want to get rid of every objects you unload the ObjectManager.

This is based off what was done here.

Some commands you should know for using this.

Create an object.
code:
fcn New.object () : ^Object


Create a smart pointer.
code:
fcn New.ptr (object : ^Object) : ^Pointer


Delete a smart pointer.
code:
proc Delete.ptr (p : ^Pointer)


Garbage collection.
code:
proc ObjectManager.collectGarbage ()


Remove all objects.
code:
proc ObjectManager.unload ()


If you look in the New and Delete module you can see that it is really easy to add your own fuctions/procedures to create and remove other objects. These modules, by the way, are there to simplify creating objects due to Turing's lack of constructors/destructors and awkward implementation of "new".



Memory Manager.T
 Description:
Here is the source. An example application is at the bottom of the code.

Download
 Filename:  Memory Manager.T
 Filesize:  6.46 KB
 Downloaded:  113 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Hackmaster




PostPosted: Sun Dec 10, 2006 9:47 am   Post subject: (No subject)

Wow. this is pretty nice, eric...

but i'm curious. why is it you post a whole bunch of things that no one is ever gonna use? I mean, the more advanced user, like me, might know what you are doing, but the more advanced user could do it himself. I admire your persistance though.

some of the stuff you've made is actually really cool. the mouse event handler? nice... and the vector class was going in the right direction as well... good job! keep it up!
ericfourfour




PostPosted: Sun Dec 10, 2006 2:02 pm   Post subject: (No subject)

I don't know why I do it Hackmaster. The thing is though. Whenever I post something like this, I always find a better way of doing it a week after.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: