-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memoryFootprint reports negative memory usage #201
Comments
Possible duplicate of #24. I unfortunately can't be very helpful; I'm seeing the same issue and I similarly don't know the root cause. Not all benchmarks on my end are seeing negatives, but the negatives make me hesitant to trust the other results. |
The Are you returning the object whose size you want to measure from the test? Can you increase the number of execution runs, or the size of the measured object? Also, it's generally helpful to post the complete snippet where this happens. |
For my specific case, I'm interested in peak memory usage during execution. It's acceptable if this can be measured only after GC occurs. The main issue with measuring at the end in my case is that my application allocates memory frequently and creates lots of garbage in the process, and memory usage is expected to be at its peak about halfway through execution. Is there a way to gather this sort of peak memory usage with scalameter? |
Hi,
Yes, there is a way to do it, but you would have to define your own `Measurer` subclass.
You would have to implement its `measure` method to, for example:
1. Run GC and immediately call `totalMemory - freeMemory` to determine the baseline footprint.
2. Start a new thread that will repetitively sample the `totalMemory - freeMemory`.
3. Run the benchmark snippet.
4. Tell the thread that was doing the sampling to stop, and collect its readings.
5. Find the maximum value among those readings.
Then, you should use your custom measurer to when overriding the `measurer` method of the benchmark snippet.
…On Mon, Jun 18, 2018 at 11:57:30AM -0700, Kyle Dewey wrote:
For my specific case, I'm interested in peak memory usage during
execution. It's acceptable if this can be measured only after GC occurs.
The main issue with measuring at the end in my case is that my application
allocates memory frequently and creates lots of garbage in the process,
and memory usage is expected to be at its peak about halfway through
execution.
Is there a way to gather this sort of peak memory usage with scalameter?
-
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Can you confirm whether this is supposed to happen?
If you can confirm this is not expected behaviour, I can see if I can publish the tests causing this.
The text was updated successfully, but these errors were encountered: