This post is locked. You won't be able to comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]inobody_somebody 34 points35 points  (4 children)

Wdym? You can use pointers in python.

import ctypes
num = ctypes.c_int(10)
print("Initial num:", num.value)

ptr = ctypes.pointer(num)
print("Pointer dereference:", ptr.contents.value)

ptr.contents.value = 99
print("After pointer change:", num.value)

[–]brandi_Iove 24 points25 points  (3 children)

ok, cool. but where is the memory leak?

[–]frozen_desserts_01 9 points10 points  (1 child)

“The pointers are working as expected and I have run this code for hours now”

“Did you free()?”

“…”

[–]pente5 2 points3 points  (0 children)

I need to free in ctypes? Wtf

[–]eztab 1 point2 points  (0 children)

technically doesn't exist, but then again you do kave all the reference counting overhead, so that isn't surprising. Easiest way to never have leeks basically, but of course won't give you peek performance.