[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] callout from interp.c code to objc/swift code need autorelease pool (#374)

maenu notifications at github.com
Tue Mar 12 11:19:57 UTC 2019


I took the list of VM APIs at https://isqueak.org/PlatformVMAPI and created a regex that searches for definitions of them:

```
\w+\s+\*?\s*\b(ioExit|ioDisablePowerManager|ioMicroMSecs|ioMSecs|ioLowResMSecs|ioRelinquishProcessorForMicroseconds|dir_Lookup|dir_Create|dir_Delete|dir_Delimitor|dir_SetMacFileTypeAndCreator|dir_GetMacFileTypeAndCreator|dir_PathToWorkingDir|sqFTruncate|getAttributeIntoLength|attributeSize|sqGetFilenameFromString|ioScreenSize|ioScreenDepth|ioHasDisplayDepth|ioForceDisplayUpdate|display_ioShowDisplay|ioProcessEvents|ioSetInputSemaphore|ioGetNextEvent|ioBeep|sqAllocateMemory|sqGrowMemoryBy|sqShrinkMemoryBy|sqMemoryExtraBytesLeft|reserveExtraCHeapBytes|imageName|getImageName|imageNamePutLength|imageNameGetLength|imageNameSize|vmPathSize|vmPathGetLength|sqImageFileOpen|insufficientMemorySpecifiedError|insufficientMemoryAvailableError|unableToReadImageError|browserPluginReturnIfNeeded|browserPluginInitialiseIfNeeded|ioFormPrint|ioSetFullScreen|ioSeconds|ioSetCursor|ioSetCursorWithMask|ioSetCursorARGB|ioSetDisplayMode|ioGetButtonState|ioCanRenameImage|secCanGetFileTypeOfSize|secHasSocketAccess|clearProfile|clipboardSize|clipboardReadIntoAt|clipboardWriteFromAt\n|ioLoadModule|ioFindExternalFunctionIn|ioFreeModule)\b
```

Here are the locations that define these methods in `*.m` files. I guess there are more methods that are not in the list.

A few questions remain for me:

1. Is there any way to ensure a complete list of all callouts that need to be added to the autorelease pool?
2. How does a general fix have to look? Wrap all definitions with an auto-release block, or is there a global machinery that can be hooked into?
3. Regarding ARC vs. non-ARC: Does `@autoreleasepool` even exist in non-ARC? If no, then there is no point of using `AUTORELEASEOBJ()` etc. If yes, how to audit the code for missing `AUTORELEASEOBJ()` calls?

[platforms/iOS/vm/Common/Classes/sqSqueakAttributesAPI.m#L49 attributeSize](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakAttributesAPI.m#L49)
[platforms/iOS/vm/Common/Classes/sqSqueakAttributesAPI.m#L59 getAttributeIntoLength](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakAttributesAPI.m#L59)
[platforms/iOS/vm/Common/Classes/sqSqueakCursorAPI.m#L46 ioSetCursor](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakCursorAPI.m#L46)
[platforms/iOS/vm/Common/Classes/sqSqueakCursorAPI.m#L54 ioSetCursorWithMask](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakCursorAPI.m#L54)
[platforms/iOS/vm/Common/Classes/sqSqueakCursorAPI.m#L62 ioSetCursorARGB](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakCursorAPI.m#L62)
[platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m#L96 ioProcessEvents](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m#L96)
[platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m#L125 ioSetInputSemaphore](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m#L125)
[platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m#L132 ioGetNextEvent](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m#L132)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L53 dir_GetMacFileTypeAndCreator](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L53)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L68 dir_SetMacFileTypeAndCreator](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L68)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L84 dir_Delimitor](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L84)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L94 dir_Lookup](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L94)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L166 dir_Create](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L166)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L176 dir_Delete](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L176)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L202 sqGetFilenameFromString](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L202)
[platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L224 dir_PathToWorkingDir](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m#L224)
[platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m#L393 ioExit](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m#L393)
[platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m#L407 ioDisablePowerManager](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m#L407)
[platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L68 ioScreenSize](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L68)
[platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L74 ioScreenDepth](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L74)
[platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L79 ioHasDisplayDepth](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L79)
[platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L85 ioForceDisplayUpdate](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L85)
[platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L91 ioSetFullScreen](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m#L91)
[platforms/iOS/vm/Common/Classes/sqSqueakSoundAPI.m#L45 ioBeep](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakSoundAPI.m#L45)
[platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L49 getImageName](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L49)
[platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L53 imageNameSize](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L53)
[platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L57 imageNameGetLength](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L57)
[platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L62 imageNamePutLength](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L62)
[platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L74 vmPathSize](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L74)
[platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L78 vmPathGetLength](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/Common/Classes/sqSqueakVmAndImagePathAPI.m#L78)
[platforms/iOS/vm/iPhone/sqMacUnixExternalPrims.m#L125 ioLoadModule](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/iPhone/sqMacUnixExternalPrims.m#L125)
[platforms/iOS/vm/iPhone/sqMacUnixExternalPrims.m#L157 ioFindExternalFunctionIn](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/iPhone/sqMacUnixExternalPrims.m#L157)
[platforms/iOS/vm/iPhone/sqMacUnixExternalPrims.m#L181 ioFreeModule](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/iPhone/sqMacUnixExternalPrims.m#L181)
[platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneClipboardAPI.m#L17 clipboardSize](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneClipboardAPI.m#L17)
[platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneClipboardAPI.m#L24 clipboardReadIntoAt](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/iPhone/Classes/sqSqueakIPhoneClipboardAPI.m#L24)
[platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m#L217 ioLoadModule](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m#L217)
[platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m#L361 ioFindExternalFunctionIn](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m#L361)
[platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m#L401 ioFreeModule](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m#L401)
[platforms/iOS/vm/OSX/sqSqueakOSXClipboardAPI.m#L47 clipboardSize](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/OSX/sqSqueakOSXClipboardAPI.m#L47)
[platforms/iOS/vm/OSX/sqSqueakOSXClipboardAPI.m#L54 clipboardReadIntoAt](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/iOS/vm/OSX/sqSqueakOSXClipboardAPI.m#L54)
[platforms/Mac%20OS/vm/NSCursorWrappers.m#L62 ioSetCursorARGB](https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/633350569ca478387d079651251e7e2f40600aac/platforms/Mac%20OS/vm/NSCursorWrappers.m#L62)

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/374#issuecomment-471959967
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190312/a904abbf/attachment-0001.html>


More information about the Vm-dev mailing list