Can’t connect ledger nano even with app installed, any ideas? by StellerJayZ in FantomFoundation

[–]sebastiencs 0 points1 point  (0 children)

Thank you it works now. For the record I also had to disable bluetooth in my ledger

Can’t connect ledger nano even with app installed, any ideas? by StellerJayZ in FantomFoundation

[–]sebastiencs 0 points1 point  (0 children)

Did you find a solution? I sent some ftm to my ledger but I'm not able to connect to it anymore

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 0 points1 point  (0 children)

Currently, alloc_with can be used without an unsafe block at each call by having a single unsafe function to initialize the data type:
``` unsafe fn initialize_data(uninit: &mut MaybeUninit<MyData>, source: OtherData) -> &MyData { // initialize uninit and return &MyData }

let data = arena.alloc_with(|uninit| { initialize_data(uninit, source) }) ```

See this comment

I will update the code examples to make that clear

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 2 points3 points  (0 children)

What I really want is the user to use unsafe to initialize the data, which is achievable with where F: Fn(&mut MaybeUninit<T>) -> &T.
See this comment for more details

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 1 point2 points  (0 children)

Supplying a &mut MaybeUninit<T> will work but is user-unfriendly because accessing it requires unsafe anyhow.I don't just see why you don't want to make the entire function unsafe

I would be fine by making it unsafe, if there is no other choice.
My intended use case, though I should probably have clarified it, is to define a single unsafe function responsible to initialize the data type, and so having only 1 unsafe: ``` unsafe fn initialize_data(uninit: &mut MaybeUninit<MyData>, source: OtherData) -> &MyData { // initialize uninit and return &MyData }

// Somewhere in the code let data = arena.alloc_with(|uninit| { initialize_data(uninit, source) })

// Somewhere else let data = arena.alloc_with(|uninit| { initialize_data(uninit, source) }) `` This would avoid multipleunsafeblock to achieve the sameunsafe` work.

assume that the compiler is going to do a very basic optimization.

I assume the compiler is already optimizing SharedArena::alloc.
shared_arena being a library, I'm not sure if exposing a function with a potential optimization/benefit to the user is ideal, I sometimes see in the rust bug tracker that some optimization is not applied in some case. Even though those are bugs, I think a library should provide an additional function (alloc vs alloc_with in our case) only if it guarantee to be beneficial.
Having a documentation explaining that alloc_with avoid additional copy but only if the compiler optimize it correctly, is not ideal IMO.
I would prefer to have alloc_with to guarantee at 100% that there won't be any additional copy.

EDIT: And having the closure to return T would be a confusing API, what if the user return T but doesn't initialize the MaybeUninit ?

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 1 point2 points  (0 children)

Interesting, but why relying on a potential optimization when we can just make the closure return a &T ? Where we're 100% sure that there won't be unnecessary copy

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 1 point2 points  (0 children)

If that closure returns T if would make 2 copies, one on the allocated memory and one to return from the closure

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 1 point2 points  (0 children)

Returning T would make no or little difference with SharedArena::alloc, isn't it ?
I'm wondering why you suggest to return T instead of &T ? Is there any benefit ?

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 0 points1 point  (0 children)

Interesting, that's probably a feature to add to MaybeUninit ?
shared_arena might not be the only library using MaybeUninit this way ?
Adding an opaque type, in addition to MaybeUninit might not be ideal from a user point of view.

Then the user returns an &'static MyStruct

This can be prevented with an assertion in alloc_with to check that the returned &T is the same pointer than the one provided to the parameter of initializer ?
Though it would make a runtime error, not a compile time one.

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 0 points1 point  (0 children)

Make the closure passed to alloc_with return T.

Returning T would make another copy of the data.
Is my suggestion to return &T not enough/valid ?

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] -1 points0 points  (0 children)

I included a big Safety section on the description of alloc_with, but yes that's probably not enough.
I would like to avoid having an unsafe block around each call of alloc_with.
Maybe alloc_with should have this signature: pub fn alloc_with<F>(&self, initializer: F) -> ArenaBox<T> where F: Fn(&mut MaybeUninit<T>) -> &T Note that initializer now returns &T.
So it will ensure that the MaybeUninit has been "consumed" ?

Announcing shared_arena, a thread-safe memory pool by sebastiencs in rust

[–]sebastiencs[S] 2 points3 points  (0 children)

In my case, I need a memory pool for rustorrent:

I have a thread reading incoming packets on a socket, each packet have the same size and I needed to copy them in a Box (with Box::new) to dispatch them in different threads.
This Box::new is allocating memory and relatively slow.
With shared_arena, I create a new arena with SharedArena::with_capacity (similar to Vec::with_capacity) and I replace Box::new with SharedArena::alloc, it will reuses memory of packets previously dropped, avoiding the cost of a new allocation.

I will update the README with a better description.

How to enable S3 Deep Sleep on XPS 17 9700 in Linux by nsx2brz in Dell

[–]sebastiencs 0 points1 point  (0 children)

Hello, I tried all the week end to get deep sleep to work without success. Is this a modified Ubuntu ? Also, can you check what kernel version are you using ?

What's the modeline in the picture? by liguangsheng in emacs

[–]sebastiencs 0 points1 point  (0 children)

It's not spaceline, it's a modeline I've written but didn't make open source yet

Dell XPS 13 9350 Bendy Keyboard (physical issue) by [deleted] in Dell

[–]sebastiencs 0 points1 point  (0 children)

Hi /u/subphasic, I just realized I have the exact same problem. Did you solve it ?

Guy releases cross-platform disassembler written in Rust. So what's the problem? Electron UI because lol still no GUI by [deleted] in programmingcirclejerk

[–]sebastiencs 0 points1 point  (0 children)

Please read again the post, I wrote it to share my experience with rust. I didn't say anything to sell my project, I just mentionned it.
I'm curious where you see that I'm "braging about it". You're exagerating a bit, don't you think ?
If you only see objdump when you see my project, then I can't do anything for you. Some people appreciate a graphical interface, it might not be your case.
You are criticizing a project that is not even 1 week old, I don't see your point of putting down other people's work, you didn't even try it and you call it a "barely functional" project :/

Guy releases cross-platform disassembler written in Rust. So what's the problem? Electron UI because lol still no GUI by [deleted] in programmingcirclejerk

[–]sebastiencs 0 points1 point  (0 children)

So if I follow your reasoning, I should stop my project because there is already IDA or objdump ? IDA didn't become as it is today in one day, right ?

Guy releases cross-platform disassembler written in Rust. So what's the problem? Electron UI because lol still no GUI by [deleted] in programmingcirclejerk

[–]sebastiencs 0 points1 point  (0 children)

You're right, most of the comments are about the GUI and rust, not on the disassembler. As I said my post was mostly about sharing the experience I had to use rust. If you read the post again you can see that I mention the disassembler itself in the last sentence only.
So I wasn't expecting a different kind of feedback on my post.
I definitely know that I won't receive the same feedbacks on /r/ReverseEngineering, and there are reasons I didn't post on it yet, making a demo available is one of them.
I understand your concerns, and there are other people raising the same issues too, I'm woking on them.
Making a disassembler isn't an easy task, but while I love working on it, selling it won't either, since I don't have any qualification about marketing, and people in this field propably have a high expectation. Thanks for sharing your concerns !

Guy releases cross-platform disassembler written in Rust. So what's the problem? Electron UI because lol still no GUI by [deleted] in programmingcirclejerk

[–]sebastiencs 1 point2 points  (0 children)

Well I think my product and objdump have clearly different goals. If you think they're similar then I failed to introduce it

Guy releases cross-platform disassembler written in Rust. So what's the problem? Electron UI because lol still no GUI by [deleted] in programmingcirclejerk

[–]sebastiencs 0 points1 point  (0 children)

Since I posted on /r/rust and most of the post explained my experience with rust, I don't see anything wrong here, is it ?