Coder Social home page Coder Social logo

deepsize's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

deepsize's Issues

Add support for arbitrary pointers to `Context`.

I'd love to support DeepSize for internment::ArcIntern, but doing so properly would require an interface that allows me to store which have been visited in the Context. This would also apply to any other reference-counted types presumably.

deep_size_of_children() resolves to different implementations depending on which impl blocks deep_size_of() is called in

Hello, I ran into the following surprising behavior and wonder if it's intentional.

trait MyTrait {
    fn run(&mut self);
}
#[derive(deepsize::DeepSizeOf, Default)]
struct State {
    data: Vec<String>,
}
impl State {
    fn print_deepsize(&self) {
        println!(
            "[deepsize in impl block] {:p} {}",
            self,
            self.deep_size_of()
        );
    }
}
impl MyTrait for State {
    fn run(&mut self) {
        self.data.push(String::from("foobar"));
        println!(
            "[deepsize in impl XX for YY block] {:p} {}",
            self,
            self.deep_size_of()
        );
        self.print_deepsize();
    }
}
fn main() {
    let mut state = State::default();
    state.run();
}

Running this produces the following output:

[deepsize in impl XX for YY block] 0x7fff18ea0990 8
[deepsize in impl block] 0x7fff18ea0990 126

That's surprising. I expect both calls to deep_size_of() return the same result. It seems both calls resolve to the same deep_size_of() in the DeepSize library. However, the deep_size_of_children() call in it resolves to different ones. It resolves to the derived one when deep_size_of() is called in impl State, but resolves to the following one when when deep_size_of() is called in impl MyTrait for State.

impl<T> DeepSizeOf for &mut T
where
    T: DeepSizeOf +?Sized,
{
    fn deep_size_of_children(&self, _context: &mut Context) -> usize {
        0
    }
} 

Is this intended behavior or a bug in the library?

Request for 0.3.0

Hi! We see that you've added DeepSizeOf implementations for std::net since the 0.2.0 release. We would love to be able to use this feature. Is there a next release on the horizon?

Publish deepsize_derive 0.1.1

Hey, I've noticed that currently published deepsize_derive panics on enums, although the code on master handles them fine. Looks like it just wasn't published yet?

New patch release for deepsize to use latest deepsize-derive

Thank you for cutting the new deepsize-derive release (#17), much appreciated. Could you please also cut a minor release for Deepsize which bumps its dependency on deepsize-derive from 0.1.1 to 0.1.2? That way when I use Deepsize, I will transitively pull in the newer deps.

Release for deepsize_derive

Hi! I noticed that the latest deepsize_derive on master is using syn/proc-macro2-quote 1.0 (as of commit ffc79ef), but that commit hasn't been released to crates.io yet! So the current crates.io release is still pulling in old dependencies.

If possible, could you please cut a new release of deepsize_derive? That way, my project can stop compiling the old 0.x dependencies :) Of course, if that's not possible, I can always just point my project at your master branch, instead of using crates.io. But a release would be helpful!

Thanks for your time!

Maintenance Status and Ownership

Hello @Aeledfyr,
I'm currently starting using this project and I find it very interesting and powerful, but sadly apparently unmaintained.

In the rust ecosystem it seems that we have a few similar libraries namely:

  • get-size: which has the drawback of not properly accounting for reference-counted instances
  • heapsize: which is no longer maintained and replaced by malloc_size_of which is not public and even attempting to clone the repo locally the usage experience is not very simple
  • memuse: which requires manual code writing to determine heap size of objects, provides boundaries and seems to be not maintained as well
  • ...

Given that in terms of easy to use this library is by far better than others (personal opinion) and that it seems to not be actively maintained I was wondering if I could do anything to support you with that.
Maybe I could help address the open PRs, support to create CI integration to have continuous testing and automated release (after tagging) such that we could maintain the library again.

Let me know what you think before investing significant time on this

Clarify internal methods

Currently two methods of the DeepSizeOf trait are documented as being "internal".

deepsize/src/lib.rs

Lines 80 to 82 in 8c87216

/// This is an internal function, and requires a [`Context`](Context)
/// to track visited references.
fn recurse_deep_size_of(&self, context: &mut Context) -> usize {

deepsize/src/lib.rs

Lines 92 to 94 in 8c87216

/// This is an internal function, and requires a [`Context`](Context)
/// to track visited references.
fn deep_size_of_children(&self, context: &mut Context) -> usize;

I don't recognize "internal" as being standard Rust terminology. If these methods are intended to be private implementation details of the deepsize crate, implemented and called only from deepsize code, then they should not be rendered in public API documentation.

@Aeledfyr

Document differences from heapsize crate

The heapsize crate is a popular crate with many crates depending on it and lots of downloads. From the description of deepsize, I can't tell what it would do differently than heapsize. It would be worth calling this out in the readme as well as rustdocs.

@Aeledfyr

Can Copy types own memory (that this should track)?

A blanket impl of DeepSize for all copy types would cover a significant amount of the library comparability code in this library. Can Copy types own memory, in the sense that this library tracks?

The only type that I can think of that that conflicts with this are references; they are currently defined to not measure the referenced structure, but other structures may want special logic for that.

One way to solve it would be with specialization and a default impl of DeepSize for types with Copy, but that's still a long way off. The other would be to just make a normal impl (which would be a breaking change) and hope that no one runs into cases where a specialized implementation is needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.