Memory consumption too high

Hi,

I’m having trouble with ferret and AAF blowing up with a NoMemoryError.
Sometimes when I add documents inside my rails app. Ferret starts
consuming huge amounts of memory. I’m on a machine with 2GB of memory
and it still runs out of memory. Sometimes I’m able to run
MyObject.rebuild_index and the memory doesn’t move up at all. However,
sometimes it blows up horribly with a NoMemoryError. I’m running it
from the script\console.

Here is the stack trace from runnning MyObject.rebuild_index

D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret/index.rb:277
:in add_document': failed to allocate memory (NoMemoryError) from D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret /index.rb:277:in<<’
from D:/dev/ruby/lib/ruby/1.8/monitor.rb:229:in synchronize' from D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret /index.rb:252:in<<’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/c
lass_methods.rb:199:in rebuild_index' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/c lass_methods.rb:198:inrebuild_index’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/c
lass_methods.rb:197:in rebuild_index' from D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_r ecord/connection_adapters/abstract/database_statements.rb:51:intransaction’
from
D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_r
ecord/transactions.rb:91:in transaction' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/c lass_methods.rb:196:inrebuild_index’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/c
lass_methods.rb:194:in rebuild_index' from (irb):1:inirb_binding’
from D:/dev/ruby/lib/ruby/1.8/irb/workspace.rb:52:in
`irb_binding’
from D:/dev/ruby/lib/ruby/1.8/irb/workspace.rb:52

Here is the stack trace I see when I try running my unit tests:

D:\dev\src\booksmart>rake test:units:rcov
(in D:/dev/src/booksmart)
rm -rf ./coverage/units
D:/dev/ruby/bin/ruby
“D:/dev/src/booksmart/vendor/plugins/rails_rcov/tasks/rails
_rcov.rake” --run-rake-task=test:units
(in D:/dev/src/booksmart)
rcov.cmd -o “D:/dev/src/booksmart/coverage/units” -T -x
“rubygems/,rcov” --rai
ls -Ilib;test
“D:/dev/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test
loader.rb" “test/unit/book_test.rb” “test/unit/cart_test.rb”
"test/unit/credit

card_test.rb” “test/unit/line_item_test.rb” “test/unit/note_test.rb”
“test/unit/
notifications_test.rb” “test/unit/publisher_test.rb”
"test/unit/purchase_test.rb
" “test/unit/user_test.rb” “test/unit/pinning_test.rb”
“test/unit/page_test.rb”

Loaded suite D:/dev/ruby/bin/rcov
Started
D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret/index.rb:277
:in add_document': failed to allocate memory (NoMemoryError) from D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret /index.rb:277:in<<’
from D:/dev/ruby/lib/ruby/1.8/monitor.rb:229:in synchronize' from D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret /index.rb:252:in<<’
from
D:/dev/src/booksmart/config/…/vendor/plugins/acts_as_ferret/lib/in
stance_methods.rb:85:in ferret_create' from D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_r ecord/callbacks.rb:344:incallback’
from
D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_r
ecord/callbacks.rb:341:in callback' from D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_r ecord/callbacks.rb:266:increate_without_timestamps’
from
D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_r
ecord/timestamp.rb:30:in create' ... 22 levels... from D:/dev/ruby/lib/ruby/1.8/test/unit/autorunner.rb:200:inrun’
from D:/dev/ruby/lib/ruby/1.8/test/unit/autorunner.rb:13:in
`run’
from D:/dev/ruby/lib/ruby/1.8/test/unit.rb:285
from D:/dev/ruby/bin/rcov:18

Sorry here is a better format stack trace:

D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret/index.rb:277:in
add_document': failed to allocate memory (NoMemoryError) from D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret/index.rb:277:in<<’
from D:/dev/ruby/lib/ruby/1.8/monitor.rb:229:in synchronize' from D:/dev/ruby/lib/ruby/gems/1.8/gems/ferret-0.10.9-mswin32/lib/ferret/index.rb:252:in<<’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:199:in
rebuild_index' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:198:inrebuild_index’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:197:in
rebuild_index' from D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/database_statements.rb:51:intransaction’
from
D:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:91:in
transaction' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:196:inrebuild_index’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/class_methods.rb:194:in
rebuild_index' from (irb):1:inirb_binding’
from D:/dev/ruby/lib/ruby/1.8/irb/workspace.rb:52:in
`irb_binding’
from D:/dev/ruby/lib/ruby/1.8/irb/workspace.rb:52

Oh why doesn’t this forum have preview!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs