Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:43:16+00:00 2026-06-17T06:43:16+00:00

this has been giving me a headache for a couple weeks now — hope

  • 0

this has been giving me a headache for a couple weeks now — hope somebody can help. I’m building an app for iOs 5.0, using the 2.1.4 SDK in Titanium mobile. My app pulls data from a database, and displays it in a scrollableview using labels and a table. I’ve noticed that it crashes after a while, and according to instruments, the views within the scrollableView, along with the labels and tableviews, are never released from memory. I use a lot of commonJS, and my code looks someting like this (stripped down):

The ApplicationWindow module, which I call from app.js

function ApplicationWindow(title) {
var self = Ti.UI.createWindow({
    title:title,
    backgroundColor:'white'
});

var button = Ti.UI.createButton({
    height:44,
    width:200,
    title:L('openWindow'),
    top:20
});
self.add(button);

var QuizWindow = require('/ui/common/QuizWindow');

button.addEventListener('click', function() {
    //containingTab attribute must be set by parent tab group on
    //the window for this work
    qw = new QuizWindow({title: 'KCT', backgroundColor: 'white', navBarHidden: true, tabBarHidden: true});
    self.containingTab.open(qw);
});

return self;
};

module.exports = ApplicationWindow;

I then call the QuizWindow module:

function QuizWindow(args){
var instance = Ti.UI.createWindow(args);
var QuestionView = require('/ui/common/QuestionView');

var db = Ti.Database.install("/kct.sqlite","kct");
var q = db.execute("SELECT * FROM questions");

var sv = Ti.UI.createScrollableView({
    bottom: 40
});

while(q.isValidRow()){
    var id = q.fieldByName("qid");
    var question = q.fieldByName("q");
    var set = q.fieldByName("set");
    var info = q.fieldByName("info");

    var v = new QuestionView(id,set,question,info);
    sv.addView(v);
    q.next();
}

q.close();
db.close();

var button = Ti.UI.createButton({
    height:44,
    width:200,
    title:"Close",
    bottom:10
});

button.addEventListener('click', function() {
    instance.close({animation: true});
});

instance.add(sv);
instance.add(button);
return instance;
};
module.exports = QuizWindow;

and this is the QuestionView:

function QuestionView (id,set,question,infolert) {
var qview = Ti.UI.createView({
    top: 0,
    width: 'auto',
    height: 'auto',
    backgroundColor: 'white',
    questionSet: set,
    questionID: id,
    info: infolert,
    isAnswered: false       
});

var qLabel = gui.Header(question);
qLabel.top = 5;
qLabel.left = 10;
qLabel.right = 10;
qLabel.color = "#3B3B3B";
qLabel.font = {fontSize: gui.defaultFontSize+4, fontWeight: 'bold'};

var dcalc = (qLabel.text.length / 30) * ((gui.defaultFontSize+4)*1.2) + 5;

var answView = Ti.UI.createTableView({
    backgroundColor: 'white',
    top: dcalc,
    _parent: qview
});

var changeheight = function(e) {
    var lheight = e.source.rect.height;
    if(lheight && lheight > 10) answView.top = lheight + 5;
    return;
};

qLabel.addEventListener('postlayout', changeheight);


qview.add(qLabel);
qview.add(answView);

return qview;

}
 module.exports = QuestionView;

I originally had some code in there to pull data for the answers from the database, and fill the tableView with that, but I removed it for the sake of brevity. Even without that, nothing gets released. I’m really at a loss here, any advice is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:43:18+00:00Added an answer on June 17, 2026 at 6:43 am

    In the end, I solved it. It was this:

    var answView = Ti.UI.createTableView({
        (...)
        _parent: qview
    });
    

    referencing the view in the answer table kept it, and all its children, from being released. Once I removed that, they get released simply by closing the window. Hope that’s useful for someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has been giving me a headache for about two days now! I have
This problem has been giving me headaches for a while now. My app operates
I hope you will be able to help me, this has been giving me
This has been giving me trouble for some time now and no adjustments I
This seems rather simple but it has been giving me a headache. I have
A php script is giving this array (which has been passed through json_encode() )
This has been a massive headache. We use Ning as a our platform for
This has been frustrating me for a while now. I started developing a site
This has been driving me nuts. I hope it's not been asked before but
This has been driving me nuts for a week now. I have a class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.