The only available function for dumping heap trace output is DumpHeap, which outputs to stderr. However, it's problematic to use it in a web environment, because web servers tend to give "internal server error" whenever stderr is not empty. Therefore, I'd like to redirect it to stderr, but I have no idea how...
Mailing lists / fpc-pascal / 2011-08
Redirecting heap trace output to stdout
10 messages · 6 people · –
- Lleledumbo 3
- GGraeme Geldenhuys 2
- MMartin 2
- BBart 1
- JJonas Maebe 1
- MMichael Van Canneyt 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
If it's on Linux, you can redirect stderr to stdout on the commandline...
Don'tknow the exact syntax though.
Bart
leledumbo wrote 14 lines
If it's on Linux, you can redirect stderr to stdout on the commandline...
Err... it's the web server that calls my app, I didn't call it directly
The only available function for dumping heap trace output is DumpHeap, which outputs to…
leledumbo wroteTherefore, I'd like to redirect it to stderr, but I have no idea how...
assign(stderr,'somefile');
rewrite(stderr);Jonas
Jonas Maebe wroteassign(stderr,'somefile'); rewrite(stderr);
I think you might be able to use the heaptrc environment variable for that as well. Not 100% sure if it will work in the case of a web app, but I can't see why not.
See the heaptrc unit documentation for the name of the environment variable - I can't remember it off the top of my head.
Graeme Geldenhuys wrote 8 lines
When using CGI, you don't control the environment. The webserver does.
Michael.
Michael Van Canneyt wroteWhen using CGI, you don't control the environment. The webserver does.
If you are in control of the webserver (like when you are developing apps), can't you add new environment variables to Apache's configs files etc.. I vaguely remember reading something like that.
Obviously this will not work (or is not recommended) on "life" web servers. But Jonas' idea is probably easier.
assign(stderr,'somefile'); rewrite(stderr); Jonas
assign(stderr,'somefile'); rewrite(stderr);
Thanks, nicely done.
leledumbo wrote> assign(stderr,'somefile'); > rewrite(stderr); Thanks, nicely done.
Why is the file in ide only?
If it was in a package, then the users could add it to their project too. (if they want)
Martin wrote 10 lines
sorry replied to wrong mail (partly the right thread though)
