Anonymous | Login | 01-26-2021 03:07 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0003692 | [Squeak] FFI | feature | N/A | 05-21-06 22:24 | 07-14-06 15:06 | ||||
Reporter | nicolas cellier | View Status | public | ||||||
Assigned To | andreas | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.9 | ||||||
Summary | 0003692: [FFI][NEW FEATURE] ExternalAdress auto-free | ||||||||
Description |
when ExternalAddress class>>allocate: is used, care must be taken to invoke ExternalAddress>>free to release external heap memory. This is not easy and involves a lot of ensure: guards... An alternative is to use a weak registry. ExternalAddress gcallocate: use ExternalAddress finalizationRegistry, that is Object finalizationRegistry by default, but maybe a specific registry in ExternalAddress would be a good idea (not implemented). Executor is a clone of the address, as provided by default in object. Beware: never invoke free directly on a gcallocated ExternalAddress (no guard in this implementation). |
||||||||
Additional Information | |||||||||
Attached Files |
![]() |
||||||||
|
![]() |
|
(0005025 - 167 - 167 - 167 - 167 - 167 - 167) andreas 05-21-06 23:54 |
This looks very useful, thanks. One question though: Why did you have to reimplement shallowCopy? Shouldn't the implementation in Object (using a primitive) be enough? |
(0005026 - 384 - 426 - 426 - 426 - 426 - 426) nicolas cellier 05-22-06 13:13 |
Yes, super shallowCopy should do the work. Unfortunately, in my 3.9a, it calls new: instead of basicNew:, and that fails because ExternalAddress new: raise an error. I think Object>>shallowCopy should use basicNew basicNew: basicAt: basicAt:put: instVarAt: instVarAt:put: and nothing else (better if in a primitive). Implementing ExternalAddress>>shallowCopy is a workaround... |
(0005030 - 429 - 477 - 477 - 477 - 477 - 477) nicolas cellier 05-22-06 22:24 |
I did not have an image when writing last note. Object>>shallowCopy is just fine. super shallowCopy is not in Object, it is Sequenceable>>shallowCopy that is defined as copyFrom:to:, that will call new: Implementing shallowCopy there will avoid implementing postCopy for some collection, but it also make the shallowCopy not shallow (example Text new shallowCopy does not share string nor runs). Is it really a good idea? |
(0005033 - 65 - 65 - 217 - 217 - 217 - 217) andreas 05-23-06 22:18 |
Integrated in http://source.squeakfoundation.org/FFI/FFI-ar.9.mcz [^] |
(0005895 - 7 - 7 - 7 - 7 - 7 - 7) MarcusDenker 07-14-06 15:06 |
in 70XX |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
57 total queries executed. 40 unique queries executed. |