[ / / / / / / / / / / / / / ] [ dir / animu / asmr / ausneets / caco / choroy / fur / general / vg ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Email
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

New Volunteer

[–]

 No.940142>>940145 >>940295 [Watch Thread][Show All Posts]

http://hackage.haskell.org/package/primitive-maybe-0.1.0 llol @ haskell

This library provides types for working with arrays of Maybe values. The types in this library can be used as replacements for Array (Maybe a) and SmallArray (Maybe a) that consume less memory and have fewer indirections.

so haskell is so slow that you have to optimize array of maybes. And you can't do that properly you have use a totally new array type. It get sworse:

nothingSurrogate :: Any

nothingSurrogate = error "nothingSurrogate: This value should not be forced!"

{-# NOINLINE nothingSurrogate #-}

unsafeToMaybe :: Any -> Maybe a

unsafeToMaybe a =

case reallyUnsafePtrEquality# a nothingSurrogate of

0# -> Just (unsafeCoerce a)

_ -> Nothing

{-# INLINE unsafeToMaybe #-}

newSmallMaybeArray :: PrimMonad m => Int -> Maybe a -> m (SmallMutableMaybeArray (PrimState m) a)

{-# INLINE newSmallMaybeArray #-}

newSmallMaybeArray i ma = case ma of

Just a -> do

x <- newSmallArray i (unsafeCoerce a)

return (SmallMutableMaybeArray x)

Nothing -> do

x <- newSmallArray i nothingSurrogate

return (SmallMutableMaybeArray x)

unsafeToMaybe :: Any -> Maybe a

unsafeToMaybe a =

case reallyUnsafePtrEquality# a nothingSurrogate of

0# -> Just (unsafeCoerce a)

_ -> Nothing

{-# INLINE unsafeToMaybe #-}

(yes its duplicated)

https://github.com/andrewthad/primitive-maybe/blob/master/src/Data/Primitive/Array/Maybe.hs

https://github.com/andrewthad/primitive-maybe/blob/master/src/Data/Primitive/SmallArray/Maybe.hs

look at the 2 files side by side exact same shit LOL. Fucking beautiful abstraction powers. lambda calculus is amazing.

this language is joke

 No.940145

File (hide): bff42020fa1d3e8⋯.jpg (83.73 KB, 960x576, 5:3, DgAh0ACX0AEsa-N.jpg) (h) (u)

>>940142 (OP)

>Using primitive implementations of shit

>Complains about it being primitive

LMAO fuck off shill


 No.940151

Hi guys! I'm doing hre some really low-level haskell (manual ptr management). I've got a container, which I created a debug Show instance for: instance Show (SmallVectorA a) where show = show . unsafePerformIO . toList . There is noinline pragma on it. However I observed that somertimes this show prints wrong values in non-threaded env. Coudl anybody tell me why it could happen? O jsut want to understand it


 No.940174>>940293

practical functional programming == bending over backwards to convince yourself you're not using global mutable state. if you don't tell no one will notice *wink*


 No.940269

>monads are about side effects

baka baka


 No.940289>>940293

haskell is gay the more languages developed the more lisp proves it was ahead of its time


 No.940293

File (hide): 248af97e438f51c⋯.jpg (25.82 KB, 396x396, 1:1, DWk2uWDUMAEjzev.jpg) (h) (u)

>>940174

>>940289

u guys are real high IQ I can tell


 No.940295>>940296

>>940142 (OP)

>monad

>side effects

>lol-monads.jpg

1) IO is not the only monad

2) Entire point of IO monad is NOT having side effects in program, but moving them outside (into hypothetical runIO that lies outside main). Otherwise you could just have functions with side effects, like ML


 No.940296>>940298

>>940295

>IO is not the only monad

Wrong. Monad literally means one or unit.


 No.940297>>940300

bunch of people debugging whether making Either strict or making patter matches lazy would fix a memory leak. nobody knows why its leaking. I Thought this language had GC>


 No.940298


 No.940300>>940303

>>940297

>GC means memory leaks don't exist

Anon this is 101 tier programming language shit. Everything has memory leaks GC or no.


 No.940303>>940304 >>940305

>>940300

GCed languages don't leak. I'm aware that webdev shitters have tried redefining what "leak" means to where simply not discarding something is a leak, but the real meaning of leak is that the object has leaked out of the programming environment and is no longer accessible to the program yet is still consuming resources. Allocating unmanaged memory and then losing the reference to GC would be a real leak in a GCed language, like with UnmanagedMemoryStream in C#.


 No.940304

>>940303

>have tried redefining

There is no "redefining" here retard. Its what it means everywhere.


 No.940305>>940313


 No.940313>>940318

>>940305

>kikepedia article written after 2000

Yeah I know faggot, I told you it was redefined. We never used to call forgetting to free something a "leak".


 No.940317>>940318 >>940323 >>940601

Memory leak makes no sense if it's just memory you still have control over.

Analogy for the correct use of memory leak:

- You fill a sink with water but there's a crack. Some water leaks out into the room. You can no longer remove all water from the room by emptying the sink as it has escaped from the sink.

Retarded modern definition by Java Pajeets:

- You fill a sink with water. Pajeet points to the water in the sink and says some of it has leaked, yet it remains in the sink and can be emptied at any time.


 No.940318>>940319 >>940578

File (hide): 0d14604def08e8f⋯.jpg (65.74 KB, 750x717, 250:239, DUzkP4FWsAY71y8.jpg) (h) (u)

>>940313

>>940317

>The entire world world including compiler engineers and tenured phds are wrong.

>My retarded definition is the correct one. Anything that says otherwise is kike shilling

LOL. Go home kid.


 No.940319>>940321

>>940318

>I believe water inside a leak-proof sink has leaked from the sink because of wikipedia


 No.940321>>940324

File (hide): 1286060a4d2f56f⋯.jpg (38.3 KB, 475x268, 475:268, DZQqR9hVMAAQode.jpg) (h) (u)

>>940319

>My wrong analogy is wrong according to the real definition of something


 No.940323

>>940317

In your second analogy you are forgetting the part where the water is overflowing the amount of water the sink can hold spilling out into the room.


 No.940324>>940326 >>940328

File (hide): 09e9a7311611f1b⋯.png (15.15 KB, 487x80, 487:80, b-but kikepedia.png) (h) (u)

>>940321

You worthless goy, you can't even think for yourself, you trust the most manipulative people to decide what's true or false for you even when the correct answer is self-evident. Here's a patent application from 1997 with the definition we used to use of "memory leak" before Javafags co-opted a very old term. This is a legal definition that has been reviewed by a patent reviewer for accuracy.

https://patents.google.com/patent/US6560773B1/en

FUCKING OWNED, BITCH. SUCK MY DICK. CHOKE ON IT.


 No.940326>>940327

>>940324

>One particular type of memory leak means that every memory leak is like this

LOL


 No.940327

>>940326

>talking with your mouth full


 No.940328>>940329

>>940324

>A memory leak occurs when the dynamically allocated memory is not properly deallocated

So he uses the same modern definition as wikipedia


 No.940329>>940330

>>940328

>how do semicolons work


 No.940330

>>940329

>One way memory can leak is every way memory can leak


 No.940576>>940577

Haskell is a joke, but you actually have to be a smart person to get the punchline (and that can come at the cost of many months of having being sucked in to a secret club...)


 No.940577

File (hide): d1bdac5870a066d⋯.jpg (75.08 KB, 828x465, 276:155, DeO2FLzUQAAYBy-.jpg) (h) (u)


 No.940578>>940579 >>940587

>>940318

>appeal to authority

yeah dude we should all have accepted that the earth was flat and was the center of the universe


 No.940579

>>940578

the rope awaits your supple neck numale.


 No.940587

>>940578

>prove the definition of a word

anon this is not math


 No.940601>>940615

>>940317

I'm partial to the "correct" one, but think about it like a cycle of a program not returning resources it's done with. It will take more each time in a way that's unsustainable and doesn't reflect actual resource use.


 No.940615>>940645

>>940601

"correct" aka the wrong one


 No.940645>>940648

>>940615

>even though it's obviously a stupid definition, I will defend it because I was taught to


 No.940648

>>940645

>Stupid definition

Yeah memory usage increasing forever when it should be freed. No way that could be a memory leak.


 No.940650>>940652 >>940656 >>940662

>use a toilet for weeks but never flush it

>piss and shit spill out over the floor

>angry landlord demands to know what happened

"The toilet leaked"

t. /tech/ anon


 No.940652>>940662

>>940650

bad analogy

We don't call it a garbage collector leak


 No.940656>>940662

>>940650

>buy a toilet that cannot overflow

>the lid closes and locks when full

>angry wife asks why the toilet lid is locked

"The toilet leaked"

t. /tech/ anon


 No.940662>>940668

File (hide): ece565d0d71885a⋯.jpg (81.32 KB, 1200x1200, 1:1, DZ3qU4oWkAAPjEk.jpg) (h) (u)

>>940652

>>940656

>>940650

>My retarded analogy does not describe the real definition of something


 No.940668>>940673 >>940675

>>940662

>my superior analogies for "leak" would cover cases where there are no actual leaks

Anime rotted your brain. Ask your doctor if it's not too late to reattach your balls so you can resist shoddy redefinitions of a phrase that used to make sense.


 No.940673>>940676

>>940668

>Memory never being freed is not leaking anything

LOL


 No.940675

>>940668

>redefinitions

You mean the original definition that it has always been used by everyone except for larpers like you.


 No.940676>>940678

>>940673

>I forgot to rinse out my cup last night, it is full of leaked coffee

>guess there's nothing that can be done, it's out of my control

>I will have to buy a new cup


 No.940678>>940708

File (hide): 38a06bf079f727b⋯.jpg (105.25 KB, 492x661, 492:661, 38a06bf079f727be1fd04016b5….jpg) (h) (u)

>>940676

>My retarded analogy does not describe the real definition of something


 No.940708>>940709

>>940678

He's right, though. When people talk about irl leaks they mean a flaw in the system not simple negligence.


 No.940709>>940714

>>940708

>leaks they mean a flaw in the system

Yes a flaw. Like letting random shit collect in your memory forever.


 No.940714>>940715

File (hide): e0eabfed68b2cc4⋯.jpg (442.25 KB, 900x675, 4:3, creating leaks.jpg) (h) (u)

>>940709

>Hello, repairman? My gutters are leaking.

<Can you tell if it's the sealant or is there a crack in the metal?

>I just never clean them and they're full of leaves.

<That isn't a leak you moron, that's a clog. There's nothing wrong with your gutters.

Only languages where references to resources can be irrevocably lost can leak. Otherwise they cannot leak, excess memory use is just simple negligence.


 No.940715>>940716

File (hide): e7fa2a1bddbba69⋯.jpg (56.52 KB, 749x702, 749:702, DWhtk_KWkAAHHTm.jpg) (h) (u)

>>940714

>My retarded analogy does not describe the real definition of something

>The entire rest of the world is wrong

LOL


 No.940716>>940719 >>940723

>>940715

>I'm still arguing despite evidence being presented that the definition was changed after the '90s

LOL

Memory in C can leak or clog.

Memory in a GCed language can only clog.

Negligently not cleaning when you should leads to a clog. Losing the ability to clean is a leak. This is superior terminology and I shall use it from now on and you should, too.


 No.940719

File (hide): 51984fb4f312d70⋯.jpg (45.05 KB, 396x594, 2:3, DZ5nLNVVwAEYTRp.jpg) (h) (u)

>>940716

>post patent dealing with ONE WAY memory can leak

>thinking one way memory can leak is every way memory can leak

>ignoring context of the patent

>making up new term to deal with shitty incompleteness of definition


 No.940723>>940725

>>940716

Here anon you are thinking of

https://en.wikipedia.org/wiki/Unreachable_memory

not

https://en.wikipedia.org/wiki/Memory_leak

glad I could clear up those 101 tier definitions for you


 No.940725>>940727 >>940728 >>940804

>>940723

>"Unreachable memory in systems that use manual memory management results in a memory leak."

This only supports my point, anon.

There are two issues:

- Unreachable memory

- Neglected memory

In C:

- Unreachable memory -> leak

- Neglected memory -> clog

In Java:

- Unreachable memory -> normal operation

- Neglected memory -> clog

GCed languages CANNOT LEAK! Wikipedia agrees.


 No.940726

>There's someone cleaning up ass

>This mean I will never shit my pants

>So pajeet coding is fine.


 No.940727

File (hide): ab0cdd1cfc502ee⋯.jpg (157.16 KB, 1200x800, 3:2, DWUw9veW0AAPSqt.jpg) (h) (u)

>>940725

>>"Unreachable memory in systems that use manual memory management results in a memory leak."

>This only supports my point, anon.

No you retard. It's that losing a handle in a manual language causes a leak. Where as losing a handle in a managed language does not. Not every leak is caused by losing a handle. JFC what pajeet university did you graduate from. Get off this board kid.


 No.940728

>>940725

>Wikipedia agrees with me

huh lets see what they say

>However, automatic memory management can impose a performance overhead, and it does not eliminate all of the programming errors that cause memory leaks.


 No.940804>>940851

>>940725

let's go back to this:

>- You fill a sink with water but there's a crack. Some water leaks out into the room. You can no longer remove all water from the room by emptying the sink as it has escaped from the sink.

<- You fill a sink with water. Pajeet points to the water in the sink and says some of it has leaked, yet it remains in the sink and can be emptied at any time.

the GC can empty the sink at any time--but doesn't, due to an error. People call this a memory leak because the results of the error are so similar to the results of an 'actual' memory leak that you may not even know which kind of leak it is before you investigate.

programming terminology is sloppy enough that I doubt your sincerity when you complain about sloppiness this mild


 No.940807>>940808 >>940810

>have garbage collected language

>can't even collect garbage

What's the point?


 No.940808

File (hide): a03ff3fb9a1090b⋯.jpg (43.36 KB, 1080x607, 1080:607, DYbRilRX0AAUl7G.jpg) (h) (u)

>>940807

>Preventing many memory leaks that plague c are a waste of time


 No.940810>>940866

>>940807

https://ocaml.org/learn/tutorials/garbage_collection.html

free()dom ain't free. It can cost more than a good GC costs.


 No.940851>>940862 >>940864 >>941148

>>940804

>the GC can empty the sink at any time--but doesn't, due to an error.

It's not an error as far as the language is concerned. The language is still operating properly and tracking resources in the memory clog scenario. I can even connect in via JPDA and unclog a running instance if really necessary (e.g. a Mars probe).

Real memory leaks are legitimate errors at the language level as the ability of the language to ever do anything about it is gone. For implementations of malloc that don't store the metadata necessary to do a heap walk, I couldn't even cure a running instance via hacking outside of the language with ptrace. That Mars probe is fucked.

Static analysis cannot identify memory clogs, but it can often identify memory leaks. That's a clue that they're completely different issues.

>programming terminology is sloppy enough that I doubt your sincerity when you complain about sloppiness this mild

It's never too late to make a change. You just have to persist and not give up. RMS persisted for almost 25 years on the GNU/Linux naming and today many people call it GNU/Linux. Being shut down by a mere wikipedia page where the term is obviously inaccurate is pathetic and shows a lack of necessary autism for programming.


 No.940862>>940868

File (hide): 6a6c04211b35c59⋯.jpg (26.16 KB, 500x324, 125:81, DcZRUDPVQAAtNfC.jpg) (h) (u)

>>940851

>Makes up new shitty term because he cant accept the real definition of something

> by a mere wikipedia page

You mean everywhere


 No.940864>>940869

>>940851

Humm let me google your new shitty term "memory clog"... first result:

>Memory leak - Wikipedia

:^)


 No.940866>>940867

>>940810

It's disingenuous. GC proponents never mention how severe the penalty of compaction-based GC is in cache-constrained code which is practically everything fast today. And they need it to make their claims about generational collection not being slow. The first rule of optimizing GCed code is to avoid ever freeing anything which should tell you something about how fast GC really is in practice.

Meanwhile, fast C code avoids malloc/free, we use slabs. In networking, we do this not just for speed but for reliability - it avoids unpredictable memory use due to fragmentation that could cause a crash. Were GC a better method we'd use boehmgc.


 No.940867>>940874

File (hide): 9be2b90da3c1bfc⋯.jpg (142.92 KB, 1200x759, 400:253, DYGf59vXUAAoid4.jpg) (h) (u)

>>940866

>GC'd languages don't have slabs


 No.940868>>940872

>>940862

You'll never be someone like RMS. You'll always be some weeb LARPer who has to ask someone's permission to believe something.


 No.940869>>940872

>>940864

>I let wikipedia decide for me what is real

Have fun believing in 42 genders, trannies not being mentally ill, and gamergate being an attack on women in video games.


 No.940872

File (hide): 9e9e6c7f1529c7d⋯.jpg (46.35 KB, 657x493, 657:493, DW--KenUMAAQGLT.jpg) (h) (u)

>>940868

>>940869

>I don't know the real definition of something and am going to act live a massive faggot in response


 No.940874>>940876

>>940867

Proper GCed languages (Javalikes) don't have slab allocators as they're limited by type safety. The closest thing without resorting to unsafe code is object caching. Back to India, Pajeet.


 No.940876>>940877

>>940874

>type safe languages cant manipulate pointers

what kind of retard faggot are you


 No.940877>>940888

>>940876

>I have no idea what a slab allocator actually looks like in C

You must contribute so much.


 No.940888>>940897

>>940877

>>940877

okay rat. more c fags that think they are the only ones that can do pointer arithmetic. it is simply impossible to manipulate the hardware in anything other than c.


 No.940897>>940900

>>940888

>I'm so clueless that I'm not even being wrong arguing generic arrays in Java aren't tracked as individual objects, I'm being wrong about something completely random


 No.940900>>940902

File (hide): 301e9ba524c7c29⋯.jpg (119.07 KB, 1200x941, 1200:941, DXXXjnFX4AE_1XM.jpg) (h) (u)

>>940897

you sure know a lot about java anon


 No.940902>>940903

>>940900

I know a lot about everything, qt. I actually program.


 No.940903

>>940902

Just make sure to wash your hands before using the computer Aditya then you can continue your Java allocator work.


 No.941148>>941158

>>940851

>It's not an error as far as the language is concerned.

How did you even manage to finish typing this?

Who gives a shit what the language thinks?

On the many subjects of human error, languages are either helpful or not. Mostly, they're not.


 No.941158>>941166

File (hide): f6dd4439d278962⋯.jpg (76.68 KB, 870x652, 435:326, memory clog.jpg) (h) (u)

>>941148

>Who gives a shit what the language thinks?

Is it that hard to process? Memory clogs are a significantly different class of error. It's an error that the language cannot tell is an error, and thus static analysis cannot tell is an error, and thus runtime analysis cannot tell is an error, but can be corrected at any time during execution by a sufficiently capable language (many safety-critical languages have facilities that can be used for that purpose).

It's impressively stupid to try to roll that up with memory leaks, which are errors according to the language, and thus can often be detected by static analysis, and thus can often be detected by runtime analysis, but might become uncorrectable by any means during execution.

Memory leaks are a systemic failure, not just a decision made by the human that is later considered to be a mistake. As such, they are far more dangerous and warrant care to avoid. They're also worth designing automated tools to identify, and doing research on finding the best methods of detection and avoidance. There's no point to doing research on memory clogs as their cause is your programmer is a slob. No automated tool can save them from being a slob. The only tools in this space are heap visualizers which assume your slob is too slovenly to notice a problem without a visualizer rubbing their nose in it until they decide to change.


 No.941166

>>941158

>static analysis cannot tell is an error

This is incorrect. Imagine this scenario. When a user connects to the system a user object is created. When the user disconnects this user object should turn into garbage. You can prove that this happens by showing that all the references to it have been removed. I don't get why you think it is impossible. These """clogs""" happen when an object does not turn into garbage at the end of its desired lifetime.




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
78 replies | 18 images | Page ???
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / animu / asmr / ausneets / caco / choroy / fur / general / vg ][ watchlist ]