November 18, 2019 Re: dmd memory usage | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Monday, 18 November 2019 at 00:20:12 UTC, Steven Schveighoffer wrote: > I'm fighting some out of memory problems using DMD and some super-template heavy code. > > I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it incrementally, but I need to see things improving. > > Is there a straightforward way to figure out how much memory the compiler uses during compilation? I though maybe /usr/bin/time, but I feel like I don't trust the output to be the true max resident size to be what I'm looking for (or that it's 100% accurate). Is there a sure-fire way to have DMD print it's footprint? > > -Steve You can wrap the whole thing in a shell script that takes PID of the compiler, and uses psrecord [1] Python tool to give you CPU and memory chart. [1] https://pypi.org/project/psrecord/ |
November 18, 2019 Re: dmd memory usage | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Monday, 18 November 2019 at 00:20:12 UTC, Steven Schveighoffer wrote:
> I'm fighting some out of memory problems using DMD and some super-template heavy code.
>
> I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it incrementally, but I need to see things improving.
>
> Is there a straightforward way to figure out how much memory the compiler uses during compilation? I though maybe /usr/bin/time, but I feel like I don't trust the output to be the true max resident size to be what I'm looking for (or that it's 100% accurate). Is there a sure-fire way to have DMD print it's footprint?
>
> -Steve
Massif is good for this. ms_print will give you a graphical summary, and the data is human and machine readable.
The only setback being that massif can make the execution slower however I can't give exact numbers but it can be terrible.
|
November 24, 2019 Re: dmd memory usage | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 2019-11-18 01:20, Steven Schveighoffer wrote: > I'm fighting some out of memory problems using DMD and some super-template heavy code. > > I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it incrementally, but I need to see things improving. > > Is there a straightforward way to figure out how much memory the compiler uses during compilation? I though maybe /usr/bin/time, but I feel like I don't trust the output to be the true max resident size to be what I'm looking for (or that it's 100% accurate). Is there a sure-fire way to have DMD print it's footprint? You can also try the memory profiler in Instruments (shipped with Xcode). -- /Jacob Carlborg |
November 24, 2019 Re: dmd memory usage | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 11/24/19 10:34 AM, Jacob Carlborg wrote:
> On 2019-11-18 01:20, Steven Schveighoffer wrote:
>> I'm fighting some out of memory problems using DMD and some super-template heavy code.
>>
>> I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it incrementally, but I need to see things improving.
>>
>> Is there a straightforward way to figure out how much memory the compiler uses during compilation? I though maybe /usr/bin/time, but I feel like I don't trust the output to be the true max resident size to be what I'm looking for (or that it's 100% accurate). Is there a sure-fire way to have DMD print it's footprint?
>
> You can also try the memory profiler in Instruments (shipped with Xcode).
>
I've actually been using --DRT-gcopt=profile:1 -lowmem with great success. And I'm also doing this on my Linux VM, so no xcode.
The only issue is that dub somehow removes the output from the profile, so I have to dub -v then copy the command line. Not the end of the world, but it would be nice if it just output the result correctly.
-Steve
|
Copyright © 1999-2021 by the D Language Foundation