-
Notifications
You must be signed in to change notification settings - Fork 5
Memory management
JoeDralliam edited this page Aug 30, 2013
·
2 revisions
Most classes use the GC of Ocaml to delete memory allocated in the C++ side. Thus, they do not need any particular close function.
Resources are a particular case. By resources, I mean any class that may be in use even when the instance is not used to call any method on the caml side (i.e. it is used on the C++ side). As the GC cannot figure out when they are not needed anymore, they are not automatically freed; you should call method destroy to free the memory. Once destroy has been invoked, no other method call is allowed on the instance (the result would certainly be a segmentation fault).
Here is the complete list of resources:
- OcsfmlWindow.context
- OcsfmlGraphics.{texture, font}
- OcsfmlAudio.{sound_buffer}