Questions tagged [refcounting]

56 questions
0
votes
0 answers

How can I cancel the remove of a platform driver from within the module?

I have a platform driver which creates a driver that can be accessed from multiple threads. I added an IOCTL command that set an atomic_t flag. The desired behavior is: When the flag is equal to zero, unloading the module is allowed. When the flag…
0
votes
1 answer

Implement Borrow on something behind a RefCell?

I have the structs Value and RefValue in my project. RefValue is a reference-counted, dynamically borrowable Value. Now Value may contain a HashMap of RefValue, where both the key and the value is a RefValue. type ValueMap = HashMap
glasflügel
  • 325
  • 2
  • 11
0
votes
2 answers

How can I get R to modify this matrix in place after a call to fastLmPure?

I'm trying to run fastLmPure in a loop, avoiding copying a large matrix. I've pre-allocated the matrix to the size I need, and it's only the last column I need to change values in. i.e. it doesn't grow. I've boiled it down to the minimal cases…
mb147
  • 43
  • 4
0
votes
1 answer

Reference counting - internal references problem

I have implemented my own smart pointers, and everything worked fine, untill I realized a fatal flaw with my implementation. The problem was the fact that an object can have a smart pointer that potentially holds a reference to itself. the problem…
0
votes
1 answer

What is GRefString implementation in GLib?

I wonder where is the reference count stored? As the type is defined as: typedef char GRefString; And all the g_ref_string*…() functions are returning simply gchar * instead of a structure, which could hold the reference count. Is it the trick of…
psprint
  • 349
  • 1
  • 10
0
votes
0 answers

Is the memory really reclaimed when the reference count is zero?

l = [1000, 2000, 3000] print(l) del l for i in range(5): print('Hello') So is the memory of the 'list' object gets immediately freed after printing before even the for loop starts executing?
user13595466
0
votes
3 answers

Implementing reference counting in a stack-based approach in C

I am making an interpreter in C, and I'm having a problem with my reference counting. Each value (which is the interpreter's representation... of a value) is allocated with refcount 0. Once it gets added to the stack, it increments the refcount. The…
user1683333
0
votes
3 answers

Can I use interfaces without invoking hidden try-finally's

I want to refactor DelphiAST to use interfaces to deal with different types, rather than the clunky TDirectionary it uses now. Some research shows that 70%+ of the running time is spend in the dictionary. So I'll make interfaces like: TSyntaxNode =…
Johan
  • 74,508
  • 24
  • 191
  • 319
0
votes
1 answer

Can there be an ARC equivalent for C#

Coming from .NET (C#) development to do a bit of Objective-C coding, I have stumbled upon ARC (Automatic Reference Counting). I know that C++ (and probably Objective-C) have deterministic destruction semantics, and ARC seems to be another step in…
lysergic-acid
  • 19,570
  • 21
  • 109
  • 218
0
votes
1 answer

boost shared ptr makes copy when changing undelying object?

Does boost::shared_ptr ptr makes a copy when *ptr.get() = 5; suppose, the refcount was 3, after the line above will it stay 3 ? or what will happen? will the new object be allocated?
Uylenburgh
  • 1,277
  • 4
  • 20
  • 46
-1
votes
1 answer

Switching from Box to Rc for a Scheme-like Cons list doesn't compile

The program below compiles and runs if Rc is replaced with Box. Why doesn't it compile when using reference counting? This is a question about the difference between Rc and Box. use std::rc::Rc; #[derive(Debug, Clone)] pub enum ILst { …
Anthony Maida
  • 591
  • 3
  • 8
1 2 3
4