Code Monkey home page Code Monkey logo

Comments (10)

mydy1987 avatar mydy1987 commented on August 16, 2024 1

在1分的k线下,左右快速拖动,内存非常吃紧,达到500m,这个问题也是困扰我好久了

from yykline.

ghostlordstar avatar ghostlordstar commented on August 16, 2024 1

没法优化的,框架设计缺陷太大,数据处理和采用scrollView是最大的问题
只能重新设计

from yykline.

renjiale1214 avatar renjiale1214 commented on August 16, 2024 1

这个库如果接入websocket的话真的是坑翻天,每次获取新数据就要重新计算整个groupModel的数据,然后redraw当前屏幕所有数据,我马上要release了发现这个问题,真的把我坑的够呛。现在再去重构它已经来不及了,只能想办法优化一下,下个版本要弃用这个库了

from yykline.

Tanghaiwen avatar Tanghaiwen commented on August 16, 2024 1

用这个写的K线,内存消耗过大,各位大神有办法解决吗?

from yykline.

mydy1987 avatar mydy1987 commented on August 16, 2024 1

内存已经解决,没优化前,在分时线上,由于数据过大,可以到达1G闪退。要重构一下项目结构,把mainview ,volumeview ,accesorryView不要加到scrollView上,加到scrollView的父控件上,宽度一直保持不变,与scrollView的宽度相同(注意不是scrollView ContentSize的宽度)。

from yykline.

ghostlordstar avatar ghostlordstar commented on August 16, 2024

如果不能换框架的话,有个内存优化的方法,可以暂时缓解一下,就是把Y_KlineModel的属性修改下,如下图,但是也一样治标不治本,引用上一个model的方法简直奇葩,为什么不留个index?下面的groupModel可以改成weak,
wx20180502-124838

model的实现里面:

- (Y_KLineModel *)PreviousKlineModel
{
    Y_KLineModel *tempModel = nil;
//    if (!_PreviousKlineModel) {
////        _PreviousKlineModel = [[Y_KLineModel alloc] init];
        if (self.index >= 1) {
            tempModel = [self.ParentGroupModel.models objectAtIndex:(self.index - 1)];
        }else {
            tempModel = [[Y_KLineModel alloc] init];
            tempModel.DIF = @(0);
            tempModel.DEA = @(0);
            tempModel.MACD = @(0);
            tempModel.MA7 = @(0);
            tempModel.MA12 = @(0);
            tempModel.MA26 = @(0);
            tempModel.MA30 = @(0);
            tempModel.EMA7 = @(0);
            tempModel.EMA12 = @(0);
            tempModel.EMA26 = @(0);
            tempModel.EMA30 = @(0);
            tempModel.Volume_MA7 = @(0);
            tempModel.Volume_MA30 = @(0);
            tempModel.Volume_EMA7 = @(0);
            tempModel.Volume_EMA30 = @(0);
            tempModel.SumOfLastClose = @(0);
            tempModel.SumOfLastVolume = @(0);
            tempModel.KDJ_K = @(50);
            tempModel.KDJ_D = @(50);
            
            tempModel.MA20 = @(0);
            tempModel.BOLL_MD = @(0);
            tempModel.BOLL_MB = @(0);
            tempModel.BOLL_DN = @(0);
            tempModel.BOLL_UP = @(0);
            tempModel.BOLL_SUBMD_SUM = @(0);
            tempModel.BOLL_SUBMD = @(0);
            
        }
//
//    }
    return tempModel;
}

from yykline.

ghostlordstar avatar ghostlordstar commented on August 16, 2024

我也是,不过还好的是,我们的版本被拒了,我正好有时间重写了一个K线图,要不你看下我这个https://github.com/ghostlordstar/GLKLineKit ,还不太完善,不过比这个强多了,有时间还会再优化

from yykline.

ghostlordstar avatar ghostlordstar commented on August 16, 2024

@renjiale1214

from yykline.

mydy1987 avatar mydy1987 commented on August 16, 2024

现在内存在100m左右

from yykline.

WillkYang avatar WillkYang commented on August 16, 2024

你好,内存问题已经修复,谢谢支持!🙏
image

from yykline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.