Questions tagged [automatic-ref-counting]

Automatic Reference Counting (ARC) is a compiler feature that provides automatic memory management of Objective-C and Swift objects.

automatic-ref-counting
Filter by
Sorted by
Tagged with
0 votes
0 answers
59 views

Trouble with shared state updates between threads using Arc and Mutex in Rust

I'm working on a Rust application where I need to manage shared state between two threads using Arc and Mutex. The application has a Node struct that holds some data, and I'm trying to update this ...
Harsh Kumar Chourasia's user avatar
2 votes
1 answer
57 views

Should I use `weak self` on a custom stored queue?

I know that we can use strong self in DispatchQueues when we call it directly in the code, for example: func foo() { DispatchQueue.global().async { print(self.someProperty) } } But ...
Oranutachi's user avatar
0 votes
3 answers
72 views

Sequence number fill and finally sum

I'm trying to create a macro to fill rows values from 0 to 9 starting at A1 and ending at A10, it also must populate B to E with the same sequence. I know I must use count and for function, and while ...
Yoyes's user avatar
  • 9
0 votes
0 answers
46 views

Sheet binded item doesn't deinitialize SwiftUI

Have the following scenario. Basically I want to use the item binded sheet init and bind it to an optional property which will be set when we want to show the sheet. On the outside it looks perfectly ...
Boyan Pavlov's user avatar
1 vote
1 answer
42 views

How to make weak reference when setting function to closure variable

How to weak self when setting function to closure as in 1. to work same as example 2. Any ideas? class TabController: UITabBarController { func setupViewActions() { tabView.itemTapped = changeTab //...
Gorthez's user avatar
  • 401
0 votes
1 answer
40 views

Borrowing issues using variables wrapped in Arc<Mutex<>> in Rust [duplicate]

The code below can work. #[derive(Debug)] struct Test{ str1 : Option<String>, str2 : Option<String>, } fn main() { let mut test = Test{ str1 : Some(String::from("...
CreatorHell's user avatar
0 votes
0 answers
40 views

Draw a ring using the HTML5 canvas without the straight line [duplicate]

I want to draw a ring with the canvas that doesn't have the straight black line you see when you use the below code. var can = document.getElementById('canvas1'); var ctx = can.getContext('2d'); ...
Jim Andrews's user avatar
0 votes
0 answers
47 views

CoreHaptics [__NSDictionaryI dealloc] crashes EXC_BAD_ACCESS

I am receiving rare crash reports in the Objective-C plugin written for Unity iOS builds to play haptics via AHAP json format. Relevant parts of the plugin code is below. "...
BrkT's user avatar
  • 1
1 vote
0 answers
46 views

CCACHE is returning wrong result

I am using the Synopsis ARC compiler for a multi-core (two cores) application, and I have a startup.s file written in assembly. To distinguish the behavior for the application on different cores, I ...
Vazeeruddin's user avatar
1 vote
0 answers
23 views

Memory allocation in swift [duplicate]

In swift, based on Apple's documentation reference types are stored on heap and value types on stack, but if a class definition has a struct variable for example String, where will that be stored? ...
Daksh Sabharwal's user avatar
0 votes
0 answers
33 views

Counting Different cells that are the same for a list

I have to draw up panel setups for work and a lot of time goes into counting/listing how many of each panels there are, I've been looking into "count if" formulas and such with little ...
Teddi's user avatar
  • 1
0 votes
1 answer
83 views

Tkinter canvas create arc sometimes displays incorrectly

First time submitting a question. One of my object visualization programs uses arcs as a connector between lines. The starting angle and extent are calculated. With some combinations of angle and ...
daddio's user avatar
  • 1
1 vote
2 answers
185 views

Shared memory in Rust

Environment: macOS Sonoma Ver.14.0 (M1 mac) Rust Ver.1.65.0 What I want to do: I want to share a vec with an array of [u8;128] elements between multithreads. The requirements I want to perform when ...
matsuisa's user avatar
0 votes
1 answer
81 views

Memory management issue while Call Obj-C in Swift

I'm currently developing a native plugin for a Capcitor app. I have very little experience with native iOS development, Swift and Obj-C. I use a framework (FunSDK) which is written in C++. I call this ...
jalixdesign's user avatar
4 votes
2 answers
102 views

Attaching arrows to SVG Arc path

I am creating a gauge using svg. Is there a way to add an arrow at the end of the animated gauge to indicate the entered value? Since the gauge is displayed with the path's stroke-dasharray, it seems ...
Th Yoon's user avatar
  • 141
0 votes
0 answers
79 views

Enabling ARC (Automatic Reference Counting) in xamarin.ios project not working

I'm currently working on a Xamarin.iOS project, and I've enabled ARC (Automatic Reference Counting) using the following setting in the "Additional mtouch arguments" field on the iOS Build ...
RaGib Noor's user avatar
0 votes
0 answers
73 views

Swift: Ensuring deinitialization of objects in arrary

I'm new to Swift's ARC and I'm having a possibly memory problem with the following swift code: class Device { let name: String var ports: [Port] init(name: String, ports: [Port] = []) { ...
user4779109's user avatar
0 votes
0 answers
18 views

Transforming One Arc Into Another Using HTML Canvas

I need to transform an arc into another larger arc that passes through the same start and end points of the original arc. To do this the arc center and arc radius of the original arc need to be ...
Nick's user avatar
  • 9
0 votes
0 answers
10 views

Change text or string to Arc Shape

enter image description herethis is my code and i want it to be more arc shape like the image below ub.data.textShapeArcConfiguration = { curve: 800, offset_y: -1000, text_height: 1600, bottom: 1600, ...
Christopher Ross's user avatar
1 vote
1 answer
428 views

Rust struct field as arc vs. struct as arc

I have a question regarding the Arc in Rust. I want to do something with multi-threading and stumbled on Arcs to give multiple threads access to the same data. At the moment, I use a struct with the ...
Cron3x's user avatar
  • 15
0 votes
0 answers
9 views

Arcpro 3.1 won't convert to "global scene" - GISLounge tutorial

I'm working through this GISLounge tutorial: https://www.gislounge.com/map-buildings-2-5d-arcgis-pro/ I'm using Arcpro 3.1. screenshot of how it looks after I convert to map global scene. I moved ...
crawcraw's user avatar
0 votes
1 answer
73 views

How can I store automatic reference counted Swift/Objective-C objects in a C++ map without causing memory leaks when they are deleted from the map?

I have a C++ map which manages loaded regions. Each region has an associated MTLBuffer for the geometry generated after the region data is converted into a mesh. The idea is to store a reference to ...
CPlus's user avatar
  • 4,154
0 votes
0 answers
37 views

Reference data from collection data in one ViewModel as another ViewModels data [duplicate]

I currently have 2 classes. One of them is named DeckManager and holds Deck objects inside an Array collection named decks (Each Deck contains an array of Card objects). The next Class is named ...
CrisI.Kim's user avatar
0 votes
1 answer
116 views

Is using SnapKit causing memory leaks

I am using SnapKit to handle my AutoLayout. I am wondering does this code cause a memory leak because I am capturing self in a closure? writtenUpSwitch.snp.makeConstraints { $0.trailing....
Mark Thomas's user avatar
0 votes
1 answer
124 views

Why doesn't delegate work in SwiftUI with UIViewControllerRepresentable?

Here's a sample code snippet for a video player in SwiftUI, where the player's core is implemented in UIKit (specifically in PlayerViewController): struct Page: View { let delegate = Delegate() ...
FaiChou's user avatar
  • 817
0 votes
0 answers
226 views

Prisma Client not initalised while deployin app to AWS Lambda through Arc

I'm trying to deploy a remix.js app to Lambda through arc. While running app using npx run dev, everything functions properly. But when I use npx arc sandbox or deploy and run through aws lambda, I'm ...
Hakeem MRK's user avatar
1 vote
0 answers
69 views

Remix Arc Sandbox - handler is not a function Error

Tried running Remix app in Arc sandbox via this command: node ./dev sandbox after doing npx remix build. It starts a sandbox in port 3001 when accessed in the browser it throws this error: Lambda ...
calcoder's user avatar
3 votes
2 answers
225 views

Is it possible to convert a &[T] or Vec<T> to Arc<Mutex<[T]>>?

Consider the following use std::sync::{Arc,Mutex}; fn arc_mutex_from_slice<T>(v: &[T]) -> Arc<Mutex<[T]>> { todo!(); } fn main() { let v = vec![1,2,3]; println!(&...
luctowers's user avatar
1 vote
2 answers
89 views

Swift Class Deallocation Not Happening

I am writing a SwiftUI based Mac OS app that show a list of added files and allows the user to select them, and remove one or more selected files from the list, or remove everything from the list. To ...
kittonian's user avatar
  • 1,291
0 votes
0 answers
48 views

npx fusion verify & npx fusion zip

I spent a few days scratching my head about what this issue could be. I figured it out and wanted to post the solution on the internet since there wasn't any luck on google when I was searching. When ...
Bill G's user avatar
  • 1
0 votes
1 answer
49 views

Centering a String Based on a Dynamically Changing Arc

I'm in my first year of computer engineering, learning Java as my first programming language. I wanted to create a 'Fast Wheel Raffle' application, but I encountered a few issues. First of all: 1- I'm ...
Gökay Şahin's user avatar
4 votes
0 answers
131 views

How do I prevent an arbitrary object's destructor from ever running in Python?

Context I have a troublesome object from third-party code in a Python (3.10) program. The object is not written in pure Python; it's provided by an extension module. Due to a bug in the third party ...
Zac B's user avatar
  • 3,975
1 vote
0 answers
231 views

Avoid cycle Arc references without Weak in Rust

I know that the data inside an Arc is stored in heap, and when two objects have Arc reference to each other, they would not be dropped automatically by compiler. The following code shows this case. ...
hnyls2002's user avatar
  • 123
0 votes
2 answers
182 views

Lock-free concurrent field usage

Say I have the following struct: struct MyStruct { field1: Box<MyField>, field2: Box<MyField>, } and I'd like to be able to do the following: Use the fields in separate threads in ...
Avi's user avatar
  • 1,306
0 votes
0 answers
113 views

How can Power Automate make an option unavailable in a Microsoft Forms drop-down question?

How can Power Automate make an option unavailable in a Microsoft Forms drop-down question when a certain number of respondents have chosen that option? From OneDrive, I created a Forms for Excel, then ...
Jo Bed's user avatar
  • 1
0 votes
1 answer
414 views

Rust: Cannot borrow data in `Arc` as mutable, but inner data is protected via Mutex [closed]

While learning Rust, and trying to work through an example wherein a database Db is required to be shared across threads and functions. Link To Minimal Example I have wrapped the database (a struct) ...
O oLo O's user avatar
  • 33
0 votes
0 answers
22 views

In an XCTestCase function, can I immediately pass the test without actually returning from the function?

The title sounds very hacky, to be sure, but hear me out. I work on a framework, and one of our constant headaches is dealing with over-released pointers. I'm writing some test cases in which I ...
derekahc's user avatar
  • 912
0 votes
1 answer
115 views

d3.js version 7 - pie and arc - Error: <path> attribute d: Expected number, "…LNaN,NaNZ"

I'm trying to do a spin wheel with d3.js. Everything worked fine with the old version 3. The pies and arcs didn't have any problem. When switching to d3.js v5 or later, i've got an omnipresent NaN in ...
GL.awog's user avatar
  • 1,312
1 vote
1 answer
51 views

Automatic Reference Counting in Swift

I have a question about ARC in Swift, please take a look at the following code. When SecondViewController is presented, the alert will pop up, and once you click "OK" button, ...
Mark's user avatar
  • 11
2 votes
2 answers
230 views

Is a strong reference cycle created in this simple case of using URLSession?

I'm a little confused about how strong references are created and when reference cycles occur. Here's a simple example: class Model { var foo: Data? func makeRequest(url: URL) { ...
gsv37's user avatar
  • 23
0 votes
1 answer
86 views

circular progress bar with canvas arcs - not working on scroll-up javascript

This is my first post (I'm sorry if a make any mistake). I am trying to make something like a "circular progress bar" with canvas. I am a complete newbie with canvas. The program works when ...
Edy's user avatar
  • 1
0 votes
1 answer
332 views

How to cancel a thread in swift

I am facing a problem where a class instance is not being deallocated, so the app gets stuck. The class which is causing the problem is import Foundation class ResponseTimeoutQueue{ private let ...
Joice George's user avatar
0 votes
0 answers
39 views

How to get list of ARC conversion errors

I am dusting off a very old app and trying to get it cleaned up so I can re-submit it to the App Store. It was written in Objective-C using manual reference counting. I tried using the automatic ARC ...
Duncan C's user avatar
  • 130k
0 votes
1 answer
172 views

In Swift, if BOTH the parent and child classes have weak references, then what will happen?

When implementing code in Swift, we always are careful to avoid retaining the cycle, and we avoid using weak or unowned. What will happen if we declare weak for all references, all variables/...
Akshay Pure's user avatar
0 votes
0 answers
49 views

How to retain lazy instance in cross ref objects

Given two classes which reference each other and one of the refs is weak, how do I retain it when initialising locally? This is the structure of the code: class Generator { weak var machine: ...
NikoDiYana's user avatar
3 votes
1 answer
593 views

What happens when I clone a struct with Arc inside?

I would like to know what happens when I clone a struct that has properties inside of Arc. #[derive(Clone)] pub struct Foo { bar: Arc<String> } When I call clone on Foo, what happens? Is it ...
onx2's user avatar
  • 96
0 votes
1 answer
303 views

How to update attribute of polygon shapefile by iterating through each csv file?

I have multiple csv files with many columns. I would like to join the attribute of a shapefile with each csv file columns and want to export them as shapefiles related to each csv file. I am expecting ...
Jagriti Tiwari's user avatar
0 votes
0 answers
36 views

How to avoid retain cycle when assigning NSDocument as NSViewController's representedObject

I am building a macOS Document based application. I am following Apple's example code, which can be found here. In Apple's example, the NSDocument assigns itself as the NSViewController's ...
Daniel Higgott's user avatar
0 votes
1 answer
165 views

Does Swift support MRC?

I wonder if Swift supports MRC or only ARC. I know that iOS use two memory management models: ARC and MRC. But can I create an app using manual reference counting or is it only available in Objective-...
Dmytro's user avatar
  • 37
0 votes
1 answer
154 views

Multible trait objects of the same instance wrapped by Arc<Mutex<_>>

The goal is to have an object (callback_handler) implementing the traits A, B and C that can be passed to different functions that expect a trait object of type A or B, for instance. This requires ...
AlphaBeta's user avatar
  • 320

1
2 3 4 5
77