1

My program uses all of available memory, so I wanted to check which functions and abstracts are spoiling my project. I decided to use Memprof, so I installed their compiler and compiled my code with command

ocamlfind ocamlopt -package xml-light unix.cmxa str.cmxa -c -g  NKJPxmlbasics.ml NKJP.mli NKJP.ml test.ml

and then run as suggested in tutorial

ocp-memprof --exec ./test

But there is error instead of result:

Error: no memory profiling information found. Possible causes: - the application was not compiled with memory profiling support; - the application exited before any major garbage collection was performed.

I even managed once to make it work but I have no idea how it happened http://memprof.typerex.org/users/97beffbaec332eb7b2a048b94f7a38cf/2015-12-15_17-33-50_ab17218e800fe0a68fc2cfa54c13bfa6_16194/index.html

Is there any way to use this tool properly in this situation? What am I missing?

SzymonPajzert
  • 692
  • 8
  • 18
  • What does `which ocamlopt` return ? Are you sure your executable's name is `test` ? Your application was running for a (long) moment before crashing with "Out of memory" ? – iguerNL Dec 27 '15 at 19:10
  • My app didn't crash but was taking about 3 GB before I managed to finally profile memory. I found that in one recursive function I misspelled variable and it caused memory leak. – SzymonPajzert Jan 03 '16 at 12:42

1 Answers1

1

ocamlfind ... -c ... does not generate any executable. So, the ./test that you are running was probably generated by a previous command, probably without the memprof switch.

Fabrice Le Fessant
  • 4,222
  • 23
  • 36