ExternalBytes.st
changeset 22110 f91906125b39
parent 21548 892d1a455001
child 22159 c8f19ee3f888
--- a/ExternalBytes.st	Tue Jul 25 18:00:59 2017 +0200
+++ b/ExternalBytes.st	Wed Jul 26 11:24:23 2017 +0200
@@ -1418,6 +1418,22 @@
 
 !ExternalBytes methodsFor:'registration'!
 
+forgetMemory
+    "forget the underlying memory - i.e. it will NOT be freed by me,
+     and actually no reference to the underlying memory is kept.
+     Warning:
+         Unless freed by someone else (typically a C-program/client),
+         this leads to a memory leak.
+         Use this only, if memory which was allocated by me
+         is given to a C-program which frees the memory."
+
+    Lobby unregister:self.      "/ prevents finalization
+    self unprotectFromGC.       "/ no longer remembered
+    self setAddress:0 size:0.   "/ no longer accessable
+
+    "Created: / 26-07-2017 / 11:20:41 / cg"
+!
+
 protectFromGC
     "enter a reference to the receiver into the AllocatedInstances
      class variable - this prevents it from ever being finalized by
@@ -1430,13 +1446,15 @@
      a finalization method"
 
     wasBlocked := OperatingSystem blockInterrupts.
-"/    AccessLock critical:[
-	AllocatedInstances isNil ifTrue:[
-	    AllocatedInstances := IdentitySet new
-	].
-	AllocatedInstances add:self.
-"/    ]
+    "/    AccessLock critical:[
+        AllocatedInstances isNil ifTrue:[
+            AllocatedInstances := IdentitySet new
+        ].
+        AllocatedInstances add:self.
+    "/    ]
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+    "Modified (format): / 26-07-2017 / 11:21:46 / cg"
 !
 
 unprotectFromGC
@@ -1452,12 +1470,14 @@
      being called by a finalization method"
 
     wasBlocked := OperatingSystem blockInterrupts.
-"/    AccessLock critical:[
-    AllocatedInstances notNil ifTrue:[
-	AllocatedInstances remove:self ifAbsent:nil.
-    ].
-"/    ]
+    "/ AccessLock critical:[
+        AllocatedInstances notNil ifTrue:[
+            AllocatedInstances remove:self ifAbsent:nil.
+        ].
+    "/ ]
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+    "Modified (format): / 26-07-2017 / 11:21:59 / cg"
 ! !
 
 !ExternalBytes methodsFor:'resizing'!