From bug-request at octave dot org Fri Jan 14 15:27:28 2005 Subject: Serious memory leak in octave (this may be a duplicate bug report) From: Dan Nessett To: CC: Danny Nessett Date: Fri, 14 Jan 2005 15:13:45 -0600 This may be a duplicate bug report. I got tangled up in emacs using bug_report and I donıt know if it sent the email. When I attempt to display a vector of 800,000 elements, octave starts gobbling up virtual memory. The sequence of commands is: p=linspace(1,80000,800000)ı; p This is a test sequence. I discovered the bug when using plot() to plot two 800,000 vectors against each other. As you can see from the printout of ³top² below, octave consumes about 19 1/2 minutes of cpu time processing this set of commands and its virtual space grows to 2.53 Gbytes. The printout from top is just after octave finishes the second command. This is on a 1.42GHz dual-processor G4 Mac with 1 Gbytes of memory running Mac OS X 10.2. PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE 395 iTerm 7.9% 1:03.22 7 125 154 3.21M 2.66M+ 4.18M+ 120M+ 494 octave-2.1 3.8% 19:41.52 1 11 9965 884M+ 3.18M+ 127M- 2.53G+ 393 iTunes 2.3% 0:47.53 9 172 233 1.23M 1.11M- 2.26M 146M 0 kernel_tas 2.2% 0:23.52 27 0 - - - 61.5M- 643M- 356 Window Man 1.3% 0:34.73 3 241 605 2.91M+ 14.3M- 14.4M- 193M+ 517 top 0.9% 0:08.80 1 14 18 192K 248K 432K 13.6M 388 IomegaDriv 0.1% 0:01.73 1 22 32 36K 228K 256K 14.2M 504 Project Bu 0.0% 0:14.34 2 96 252 1.07M 2.75M- 3.77M 121M 391 TruBlueEnv 0.0% 0:13.85 15 182 204 1.15M 708K 448K 1.10G 519 Safari 0.0% 0:06.40 5 112 234 4.36M- 1.04M- 5.17M- 163M 180 ATSServer 0.0% 0:03.66 2 37 208 300K 968K 684K 72.8M 51 kextd 0.0% 0:01.15 2 18 23 0K 216K 56K 15.3M 384 Dock 0.0% 0:01.81 2 89 164 68K 5.68M+ 5.64M 110M 317 automount 0.0% 0:00.01 2 22 21 0K 216K 180K 14.7M 1 init 0.0% 0:00.00 1 9 12 0K 216K 152K 1.28M This bug appeared after I used the August2003 updater from Apple to move to gcc 3.3. I use fink to load open source software on my Mac. When I started having problems with octave after resynching fink, I blew away /sw and reloaded and rebuilt fink and all my other software from scratch. This did not fix the problem. Iım not a Mac OS X/Darwin/NetBSD expert, but it appears that octave is grabbing swap space and not releasing it. This is a classic symptom of a memory leak. If I run two copies of octave and execute the same sequence of commands, my Mac comes to its knees. The Finder goes out to lunch and I have to force reboot the system with the power switch. My only suggestion on a fix is to use Purify or some other memory leak detection software. Thanks for giving us Octave. It is a very nice program to use. However, until I can get a fix to this but, I canıt use it, since the problems I am working on require fairly large vectors. I ran bug_report again and copied the configuration information. Here it is. Configuration (please do not edit this section): ----------------------------------------------- uname output: Darwin localhost 6.8 Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC Power Macintosh powerpc configure opts: '--prefix=/sw' '--with-g77' '--infodir=/sw/share/info' '--mandir=/sw/share/man' '--libexecdir=/sw/lib' 'CPPFLAGS=-no-cpp-precomp -I/sw/include' 'FFLAGS=-O2' 'LDFLAGS=-L/sw/lib' Fortran compiler: g77 FFLAGS: -O2 F2C: F2CFLAGS: FLIBS: -lSystem -L/sw/lib -lfrtbegin -lg2c CPPFLAGS: -no-cpp-precomp -I/sw/include INCFLAGS: -I. -I. -I./liboctave -I./src -I./libcruft/misc -I./glob -I./glob C compiler: gcc, version 3.3 20030304 (Apple Computer, Inc. build 1493) CFLAGS: -g -O2 CPICFLAG: C++ compiler: g++, version 3.3 20030304 (Apple Computer, Inc. build 1493) CXXFLAGS: -g -O2 -Wall CXXPICFLAG: LD_CXX: g++ LDFLAGS: -L/sw/lib LIBFLAGS: -L. RLD_FLAG: BLAS_LIBS: -framework vecLib FFTW_LIBS: -ldfftw LIBS: -lreadline -lncurses -lhdf5 -lz -lm LEXLIB: LIBPLPLOT: LIBDLFCN: LIBGLOB: ./glob/glob.o ./glob/fnmatch.o SED: /usr/bin/sed DEFS: -DPACKAGE_NAME=\\\ -DPACKAGE_TARNAME=\\\ -DPACKAGE_VERSION=\\\ -DPACKAGE_STRING=\\\ -DPACKAGE_BUGREPORT=\\\ -DOCTAVE_SOURCE=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSEPCHAR=1 -DSEPCHAR_STR=\:\ -D__NO_MATH_INLINES=1 -DCXX_NEW_FRIEND_TEMPLATE_DECL=1 -DCXX_ISO_COMPLIANT_LIBRARY=1 -DCXX_ABI=gnu_v3 -DCXX_PREPENDS_UNDERSCORE=1 -DHAVE_LIBM=1 -DHAVE_HDF5_H=1 -DHAVE_HDF5=1 -DHAVE_DFFTW_H=1 -DHAVE_FFTW=1 -DF77_FUNC(name,NAME)=name ## _ -DF77_FUNC_(name,NAME)=name ## __ -DHAVE_BLAS=1 -DHAVE_GETHOSTNAME=1 -DHAVE_GETPWNAM=1 -DHAVE_DEV_T=1 -DHAVE_INO_T=1 -DHAVE_NLINK_T=1 -DHAVE_NLINK_T=1 -DHAVE_LONG_LONG_INT=1 -DHAVE_UNSIGNED_LONG_LONG_INT=1 -DHAVE_SIGSET_T=1 -DHAVE_SIG_ATOMIC_T=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DHAVE_ALLOCA=1 -DNPOS=std::string::npos -DHAVE_PLACEMENT_DELETE=1 -DSTDC_HEADERS=1 -DHAVE_DIRENT_H=1 -DTIME_WITH_SYS_TIME=1 -DH User-preferences (please do not edit this section): -------------------------------------------------- EDITOR = "emacs" EXEC_PATH = ":/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin" IMAGEPATH = ".:/sw/share/octave/2.1.46/imagelib//" INFO_FILE = "/sw/share/info/octave.info" INFO_PROGRAM = "info" LOADPATH = ":" PAGER = "less -e -P'-- less ?pB(%pB\\%):--. (f)orward, (b)ack, (q)uit$'" PS1 = "\\s:\\#> " PS2 = "> " PS4 = "+ " automatic_replot = 0 beep_on_error = 0 completion_append_char = " " default_eval_print_flag = 1 # default_global_variable_value = default_return_value = [] default_save_format = "ascii" define_all_return_values = 0 do_fortran_indexing = 0 echo_executing_commands = 0 empty_list_elements_ok = 1 fixed_point_format = 0 gnuplot_binary = "gnuplot" gnuplot_command_end = "\n" gnuplot_command_plot = "pl" gnuplot_command_replot = "rep" gnuplot_command_splot = "sp" gnuplot_command_title = "t" gnuplot_command_using = "u" gnuplot_command_with = "w" gnuplot_has_frames = 1 gnuplot_has_multiplot = 1 history_file = "/Users/dnessett/.octave_hist" history_size = 1024 ignore_function_time_stamp = "system" implicit_num_to_str_ok = 0 implicit_str_to_num_ok = 0 initialize_global_variables = 0 max_recursion_depth = 256 ok_to_lose_imaginary_part = "warn" output_max_field_width = 10 output_precision = 5 page_output_immediately = 0 page_screen_output = 1 prefer_column_vectors = 1 print_answer_id_name = 1 print_empty_dimensions = 1 print_rhs_assign_val = 0 propagate_empty_matrices = 1 resize_on_range_error = 1 return_last_computed_value = 0 save_precision = 15 saving_history = 1 silent_functions = 0 split_long_rows = 1 string_fill_char = " " struct_levels_to_print = 2 suppress_verbose_help_message = 0 treat_neg_dim_as_zero = 0 warn_assign_as_truth_value = 1 warn_divide_by_zero = 1 warn_function_name_clash = 1 warn_future_time_stamp = 1 warn_missing_semicolon = 0 warn_variable_switch_label = 0 whitespace_in_literal_matrix = ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------