Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
100 views

Using go version go1.25.3 darwin/arm64. The below implementation is a simplified version of the actual implementation. type WaitObject struct{ c chan struct{} } func StartNewTestObject(d time....
Ahmad Sameh's user avatar
2 votes
1 answer
171 views

In the following JavaScript, does the object destructuring that follows the creation of target create a new (temporary) object that has to be garbage collected? In other words, are there two objects ...
user3163495's user avatar
  • 3,968
1 vote
0 answers
59 views

When running the following code: events <- read.csv("C:\\Users\\jsh274\\OneDrive - University of Canterbury\\6. Data\\3. Scvenja_data\\3. Jeniya\\1. Analysis\\Output\\3.1 ...
JSS's user avatar
  • 31
-2 votes
1 answer
44 views

A simple question that if I do malloc but without free before exit(), the system should free all memory of the daemon automatically, is it correct?
samp lin's user avatar
0 votes
1 answer
163 views

Recently, I came across std::start_lifetime_as, which got me reading about c++ lifetimes in general. This has got me confused about something else, mainly, how to create an array of uninitialized ...
Malphrush's user avatar
  • 338
1 vote
0 answers
116 views

Old Approach Previously my clause table was much more complicated storing the literals field of the clauses in a Vec which would then be indexed by a Range in a ClauseMetaData structure. But this made ...
James Trewern's user avatar
4 votes
1 answer
160 views

I have a basic block-based allocator that will be used to allocate memory for POD-types in a multi-threaded setting, where all threads will be requesting or releasing memory simultaneously to a shared ...
Robert Good's user avatar
0 votes
0 answers
77 views

I have a service that selects tasks from Redis using a Lua script. I can select up to 1000 tasks at a time. Every 250 milliseconds I will retrieve tasks, and there are several such modules in one ...
Марк's user avatar
1 vote
1 answer
136 views

I am having a specific problem in julia, I cannot seem to figure out. I broke down my code to some minimal working example to demonstrate the problem: using BenchmarkTools function f!(u::Vector) ...
User341562's user avatar
0 votes
0 answers
51 views

Right now I am using Optim.jl to optimise my problem, however, @btime shows the whole script has around hundreds allocations...which is quite a lot. So is there any trick to reduce the allocations to ...
Xu Shan's user avatar
  • 325
1 vote
2 answers
128 views

I am casually reading about the Memory<T> class in C#, to figure out if I can use it to "format" memory allocations to be more contiguous. I don't know a lot of the finer details of ...
Depenau's user avatar
  • 131
0 votes
4 answers
185 views

As far as I know, malloc does not initialize the allocated memory. However, on macOS arm64, all values appear as zero. Why does this phenomenon occur? Is this related to ASLR? #include <stdio.h> ...
Jinwoo Kim's user avatar
0 votes
1 answer
91 views

I try to run the following code on (a 64-bit) gfortran 14.2 program test1 real, allocatable :: a(:), b(:,:) ! allocate( a(3870457856_8) ) allocate( b(8000, 2000000) ) end program test1 and ...
Pavel Ruzankin's user avatar
0 votes
1 answer
70 views

For Fortran 2003 (IIUC), the following allocate upon assignment to variable c is legit: integer, dimension(:), allocatable :: a, b, c allocate(a(5), stat=istat) ... allocate(b(4), stat=istat) ... c = [...
frankeye's user avatar
1 vote
1 answer
120 views

I have pretty basic benchmark comparing performance of mutex vs atomic: const ( numCalls = 1000 ) var ( wg sync.WaitGroup ) func BenchmarkCounter(b *testing.B) { var ...
vtm11's user avatar
  • 409
0 votes
0 answers
31 views

C++ 20 I have this function: int (*funcArrayReturn())[6]; The function returns a pointer to an array int[6] (6 elements aggregated). And I need a pointer of pointers of n elements(in this case 3) ...
BeginnerVS2019's user avatar
0 votes
0 answers
35 views

I have loop where I initialize new object. For example let count = 0; for(let i = 0; i < 10; i++){ const objectExample = new SomeObject() } SomeObject is object from external library. I don't ...
comm1ted's user avatar
  • 128
0 votes
1 answer
76 views

I know that depending of the implementation of malloc, the algorithm used differs (free linked lists, buckets, binary buddy... - and often it is a mix). So I was wondering if it is possible to know ...
touikss's user avatar
4 votes
1 answer
122 views

I was thinking about the utility of non-standard __restrict keyword in C and C++ and how its effect can be emulated by carefully declare (disjoint) value objects . Restrict is usually explained ...
alfC's user avatar
  • 16.8k
0 votes
1 answer
98 views

Unfortunately problem looks for me to be quite complex. I'm having set of structs and function. Pardon me for terrible naming. hashmap.h #ifndef HASHMAP_H #define HASHMAP_H typedef struct HashMapNode ...
h0ax's user avatar
  • 45
-3 votes
1 answer
126 views

i have a small question about 'append' function in golang: I have a slice1 and a function which calls in for loop and returns some slice2 which can be empty as well. So the question is how golang will ...
MaksimFeed's user avatar
1 vote
1 answer
149 views

When declaring std::string cpp{}; does this call new/malloc? Assume we already have a const char* c. Is it possible to move the contents from c to cpp without extra allocations?
SpeakX's user avatar
  • 427
0 votes
0 answers
69 views

I want to allocate 20 districts on a map to 4 institutions. Below are the data I have. district = {'d1', 'd2', ..., 'd20'} institution = {'i1', 'i2', 'i3', 'i4'} distance_in_km = { 'd1': [['i1', ...
lukephm's user avatar
0 votes
1 answer
44 views

Just a simple and straightforward question as to why pandas does not provide a method that allocates a DataFrame of a given size (defaults to List[Series[object]], or if schema is given, allocate to ...
Jim's user avatar
  • 841
0 votes
1 answer
103 views

I want to calculate the (generalized) inverse of a 30807 x 30807 matrix. I tried to use np.linalg.pinv(matrix), and the error "MemoryError: Unable to allocate 7.07 GiB for an array with shape (...
Y H's user avatar
  • 17
2 votes
2 answers
205 views

C# allows you to create an array without it being initialized with GC.AllocateUnitializedArray<T>. T can be any type, such as bool or int. However, I do not know of a way to do this to a 2D ...
CubeX's user avatar
  • 23
1 vote
1 answer
66 views

I don't entirely understand allocation, so this may be a simple problem, but I wrote this Fortran code: program name implicit none integer :: A, B integer, dimension(:), allocatable :: ARR ...
JoeTheGreatest616's user avatar
0 votes
0 answers
43 views

The following little code compiles and runs w/o error, and gives expected results: $ cat ptrpractice.F90 program ptrpractice integer, allocatable, target :: c(:) integer, pointer :: d(:) allocate(c(...
bob.sacamento's user avatar
-1 votes
1 answer
158 views

I come to C and C++ from Assembly before 2.5 decades. I inherited some things implied in assembly, to both C and C++, but later I realized that these things are actually undefined behavior. One of ...
Chameleon's user avatar
  • 2,239
0 votes
2 answers
273 views

For the sake of the ensuing question, assume hypothetically that I want to convert a plain-text string into a hexadecimal string; for example, "Hello, World!" into "...
Matthew Layton's user avatar
-1 votes
2 answers
314 views

I tried this quick-bench test and I'm finding that it's the same cost timewise to allocate 200 bytes as it is to allocate 2000000 bytes. How could that possibly be?
bobobobo's user avatar
  • 67.9k
0 votes
1 answer
124 views

In Rider Resharper suggests to simplify string interpolation. When doing so, the Heap Allocation Viewer plugin warns me about boxing allocation. And indeed, the IL code is different and when running ...
Meister der Magie's user avatar
0 votes
1 answer
206 views

I've been experimenting with the Rust allocator_api feature and have developed a simple linear allocator. My test cases show this works as expected. However, I want to be able to nest allocators, e.g.:...
junglie85's user avatar
  • 1,549
3 votes
1 answer
97 views

I have lately been experimenting with overloading the new and delete operators, and I noticed something very interesing. When I allocate, let's say, class T with new T(); vs new T[1](), there is a ...
Enigma24's user avatar
0 votes
2 answers
124 views

I have a working generic graph. The type for vertex is currently defined as: typedef struct vertex { void *data; char *label; bool inGraph; } vertex; The void pointer can then be customized for ...
Neutrino's user avatar
0 votes
0 answers
94 views

While liked-list buckets implementation in std::unordered_map works well when one needs to add/remove elements from the container, it still could be speed up significantly if “stable” or “read-only” ...
Damir Tenishev's user avatar
0 votes
1 answer
98 views

I'm a beginner in C++, and I don't understand why I can't make this kind of while loop : #include <iostream> using namespace std; const int gridRows = 3; const int gridColumns = 3; string **...
iesnihS's user avatar
  • 13
1 vote
2 answers
91 views

As I understand, when function is called from translation unit and this function uses global variable of this translation unit, variable address is unchangable. In case of recalling function from this ...
Mixen's user avatar
  • 51
0 votes
0 answers
29 views

I would like to fail gracefully with an error message if vnl_matrix (c++ code) cannot allocate enough memory for initialisation or resizing. Just constructing a large matrix produces a segfault: #...
highwind's user avatar
0 votes
0 answers
73 views

C++ Collection of different types of static elements Greetings! Unfortunately my C++ is not very good. For an embedded system, I need to implement the task using ONLY STATIC memory allocation. There ...
Андрей Черепенко's user avatar
1 vote
2 answers
160 views

In my program I have a method that instantiates a structure and returns it something like this struct A { int a; double * dblPtr; double ** dblMatrix; } struct A initStruct(int a) { ...
willaayy's user avatar
0 votes
1 answer
79 views

I'm not understanding why this code in C doesn't give me an output other than the first printf, and I would like some help. I've already tried swapping the names to input and read the file where I'm ...
Vincenzo Cristina Leone Di Bel's user avatar
1 vote
1 answer
876 views

I'm working on leetcode problem 88 https://leetcode.com/problems/merge-sorted-array/description/?envType=study-plan-v2&envId=top-interview-150 which merges a vector into another vector. Therefore ...
Pioneer_11's user avatar
  • 1,441
2 votes
1 answer
136 views

I am having trouble understanding why allocations are occurring during broadcast assignment, where all operations involved are themselves broadcasted. I am using Julia v1.10. using BenchmarkTools ...
BallpointBen's user avatar
  • 15.6k
0 votes
0 answers
47 views

If I understand correctly, the RAM is virtually divided into stack and heap. Stack takes primitive types/functions etc and Heap deals with the reference types and objects. Stack follows the LIFO ...
Hopen's user avatar
  • 1
0 votes
2 answers
217 views

#include <utility> #include <vector> #include "iostream" class Person { public: std::string name{"no-name"}; Person() { std::cout << std::string(...
strider aron's user avatar
0 votes
0 answers
82 views

I have a memory structure that contains various structures and variables defined as below with CRCr as UNION struct that defines uint16_t and two uint8_t variables. Later struct containing bits and ...
bajtec's user avatar
  • 155
0 votes
1 answer
373 views

I need to write my own reverse.Reverse analog for unicode strings. This is my code: func Reverse(input string) string { runes := []rune(input) var result strings.Builder result.Grow(len(...
smisshin's user avatar
0 votes
0 answers
46 views

I'm checking the bytes of s=a variable allocated in memory using Python. The result is 50 Will I get the same 50 bytes if I do the same in other languages? My Python code is here import sys s ='a' ...
Jora Karyan's user avatar
0 votes
1 answer
140 views

I have simple benchmark to compare performance for creating slice of structs and slice of pointers to that structs package pointer import ( "testing" ) type smallStruct struct { ID ...
Dmitry Ermichev's user avatar

1
2 3 4 5
39